Skip to content

Commit d4eaa6b

Browse files
committed
feat(components/admin): refactor email assets and introduce portal files management
- Replaced the email images library in AdminEmailAssets.vue with a new AdminPortalFiles component for better file management. - Added AdminPortalFiles.vue to handle file uploads, deletions, and searching within the portal files. - Updated routing and admin index to include the new portal files feature.
1 parent d3a9fba commit d4eaa6b

File tree

5 files changed

+331
-99
lines changed

5 files changed

+331
-99
lines changed
Lines changed: 2 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,7 @@
1-
<!-- EmailImageLibrary.vue -->
21
<template>
3-
<div class="email-images-library">
4-
<div class="header-section">
5-
<h3>{{ $t('Email Images') }}</h3>
6-
<base-button
7-
:text="$t('Clear Cache')"
8-
:alt="$t('Clear Cache')"
9-
data-testid="testClearEmailImagesCacheButton"
10-
variant="outline"
11-
size="small"
12-
:disabled="isClearing"
13-
:show-spinner="isClearing"
14-
:action="clearEmailImagesCache"
15-
>
16-
{{ $t('Clear Cache') }}
17-
</base-button>
18-
</div>
19-
<div class="images-grid">
20-
<div
21-
v-for="image in emailImages"
22-
:key="image.file_key"
23-
class="image-item"
24-
>
25-
<img :src="image.signed_url" alt="" class="image-thumbnail" />
26-
<base-button
27-
variant="outline"
28-
size="small"
29-
@click="copyImageLink(image.signed_url)"
30-
>
31-
{{ $t('Copy Link') }}
32-
</base-button>
33-
</div>
34-
</div>
35-
</div>
2+
<AdminPortalFiles />
363
</template>
374

385
<script setup lang="ts">
39-
import axios from 'axios';
40-
import { useI18n } from 'vue-i18n';
41-
import { useToast } from 'vue-toastification';
42-
import BaseButton from '@/components/BaseButton.vue';
43-
import { useEmailImagesClearCache } from '@/hooks/useEmailImagesClearCache';
44-
45-
const { t } = useI18n();
46-
const $toasted = useToast();
47-
const { clearEmailImagesCache, isClearing } = useEmailImagesClearCache();
48-
49-
const emailImages = ref<any[]>([]);
50-
51-
const copyImageLink = (url: string) => {
52-
navigator.clipboard
53-
.writeText(url)
54-
.then(() => {
55-
$toasted.success(t('Image link copied to clipboard.'));
56-
})
57-
.catch(() => {
58-
$toasted.error(t('Failed to copy image link.'));
59-
});
60-
};
61-
62-
// Fetch email images on component mount
63-
onMounted(async () => {
64-
try {
65-
const response = await axios.get('admins/email-images');
66-
emailImages.value = response.data;
67-
} catch {
68-
$toasted.error(t('Failed to load email images.'));
69-
}
70-
});
6+
import AdminPortalFiles from '@/components/admin/AdminPortalFiles.vue';
717
</script>
72-
73-
<style scoped>
74-
.email-images-library {
75-
padding: 1rem;
76-
max-height: 80vh;
77-
overflow-y: auto;
78-
}
79-
.header-section {
80-
display: flex;
81-
justify-content: space-between;
82-
align-items: center;
83-
margin-bottom: 1rem;
84-
}
85-
.email-images-library h3 {
86-
font-size: 1.25rem;
87-
margin: 0;
88-
}
89-
.images-grid {
90-
display: grid;
91-
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
92-
gap: 1rem;
93-
}
94-
.image-item {
95-
border: 1px solid #ddd;
96-
padding: 0.5rem;
97-
text-align: center;
98-
}
99-
.image-thumbnail {
100-
max-height: 100px;
101-
object-fit: contain;
102-
margin-bottom: 0.5rem;
103-
}
104-
</style>

0 commit comments

Comments
 (0)