@escalated-dev/escalated 0.2.1 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/package.json +1 -1
  2. package/src/components/ActivityTimeline.vue +8 -4
  3. package/src/components/AssigneeSelect.vue +6 -2
  4. package/src/components/AttachmentList.vue +9 -3
  5. package/src/components/EscalatedLayout.vue +219 -213
  6. package/src/components/FileDropzone.vue +9 -4
  7. package/src/components/PriorityBadge.vue +20 -2
  8. package/src/components/ReplyComposer.vue +52 -3
  9. package/src/components/ReplyThread.vue +14 -6
  10. package/src/components/SlaTimer.vue +12 -6
  11. package/src/components/StatsCard.vue +26 -6
  12. package/src/components/StatusBadge.vue +24 -2
  13. package/src/components/TagSelect.vue +8 -4
  14. package/src/components/TicketFilters.vue +17 -11
  15. package/src/components/TicketList.vue +45 -2
  16. package/src/components/TicketSidebar.vue +21 -14
  17. package/src/pages/Admin/CannedResponses/Index.vue +29 -17
  18. package/src/pages/Admin/Departments/Form.vue +12 -11
  19. package/src/pages/Admin/Departments/Index.vue +26 -18
  20. package/src/pages/Admin/EscalationRules/Form.vue +21 -20
  21. package/src/pages/Admin/EscalationRules/Index.vue +26 -18
  22. package/src/pages/Admin/Reports.vue +30 -16
  23. package/src/pages/Admin/Settings.vue +260 -0
  24. package/src/pages/Admin/SlaPolicies/Form.vue +21 -20
  25. package/src/pages/Admin/SlaPolicies/Index.vue +28 -20
  26. package/src/pages/Admin/Tags/Index.vue +48 -23
  27. package/src/pages/Admin/Tickets/Index.vue +22 -0
  28. package/src/pages/Admin/Tickets/Show.vue +109 -0
  29. package/src/pages/Agent/Dashboard.vue +37 -25
  30. package/src/pages/Agent/TicketShow.vue +12 -12
  31. package/src/pages/Customer/Show.vue +2 -2
  32. package/src/pages/Guest/Create.vue +97 -0
  33. package/src/pages/Guest/Show.vue +86 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@escalated-dev/escalated",
3
- "version": "0.2.1",
3
+ "version": "0.3.5",
4
4
  "description": "Vue 3 + Inertia.js UI components for Escalated — the embeddable support ticket system",
5
5
  "author": "Escalated Dev <hello@escalated.dev>",
6
6
  "license": "MIT",
@@ -1,8 +1,12 @@
1
1
  <script setup>
2
+ import { computed, inject } from 'vue';
3
+
2
4
  defineProps({
3
5
  activities: { type: Array, required: true },
4
6
  });
5
7
 
8
+ const dark = inject('esc-dark', computed(() => false));
9
+
6
10
  const typeLabels = {
7
11
  status_changed: 'changed status',
8
12
  assigned: 'assigned ticket',
@@ -51,12 +55,12 @@ function describeActivity(activity) {
51
55
  <template>
52
56
  <div class="space-y-3">
53
57
  <div v-for="activity in activities" :key="activity.id" class="flex gap-3 text-sm">
54
- <div class="mt-1 h-2 w-2 flex-shrink-0 rounded-full bg-gray-400"></div>
58
+ <div :class="['mt-1 h-2 w-2 flex-shrink-0 rounded-full', dark ? 'bg-neutral-600' : 'bg-gray-400']"></div>
55
59
  <div class="flex-1">
56
- <p class="text-gray-700">{{ describeActivity(activity) }}</p>
57
- <p class="text-xs text-gray-400">{{ formatDate(activity.created_at) }}</p>
60
+ <p :class="dark ? 'text-neutral-300' : 'text-gray-700'">{{ describeActivity(activity) }}</p>
61
+ <p :class="['text-xs', dark ? 'text-neutral-600' : 'text-gray-400']">{{ formatDate(activity.created_at) }}</p>
58
62
  </div>
59
63
  </div>
60
- <div v-if="!activities?.length" class="py-4 text-center text-sm text-gray-500">No activity yet.</div>
64
+ <div v-if="!activities?.length" :class="['py-4 text-center text-sm', dark ? 'text-neutral-600' : 'text-gray-500']">No activity yet.</div>
61
65
  </div>
62
66
  </template>
@@ -1,17 +1,21 @@
1
1
  <script setup>
2
+ import { computed, inject } from 'vue';
3
+
2
4
  defineProps({
3
5
  agents: { type: Array, required: true },
4
6
  modelValue: { type: [Number, String], default: null },
5
7
  });
6
8
 
7
9
  const emit = defineEmits(['update:modelValue']);
10
+ const dark = inject('esc-dark', computed(() => false));
8
11
  </script>
9
12
 
10
13
  <template>
11
14
  <div>
12
- <label class="mb-1 block text-xs font-medium text-gray-600">Assigned To</label>
15
+ <label :class="['mb-1 block text-xs font-medium', dark ? 'text-neutral-500' : 'text-gray-600']">Assigned To</label>
13
16
  <select :value="modelValue" @change="emit('update:modelValue', $event.target.value || null)"
14
- class="w-full rounded-md border border-gray-300 px-2 py-1.5 text-sm focus:border-blue-500 focus:outline-none">
17
+ :class="['w-full rounded-md border px-2 py-1.5 text-sm focus:outline-none',
18
+ dark ? 'border-white/10 bg-neutral-950 text-neutral-200 focus:border-white/20 focus:ring-1 focus:ring-white/10' : 'border-gray-300 focus:border-blue-500']">
15
19
  <option value="">Unassigned</option>
16
20
  <option v-for="agent in agents" :key="agent.id" :value="agent.id">{{ agent.name }}</option>
17
21
  </select>
@@ -1,8 +1,12 @@
1
1
  <script setup>
2
+ import { computed, inject } from 'vue';
3
+
2
4
  defineProps({
3
5
  attachments: { type: Array, required: true },
4
6
  });
5
7
 
8
+ const dark = inject('esc-dark', computed(() => false));
9
+
6
10
  function formatSize(bytes) {
7
11
  if (bytes < 1024) return bytes + ' B';
8
12
  if (bytes < 1048576) return (bytes / 1024).toFixed(1) + ' KB';
@@ -20,12 +24,14 @@ function iconForMime(mime) {
20
24
  <template>
21
25
  <div class="space-y-1">
22
26
  <div v-for="attachment in attachments" :key="attachment.id"
23
- class="flex items-center gap-2 rounded border border-gray-200 bg-gray-50 px-3 py-2 text-sm">
27
+ :class="['flex items-center gap-2 rounded-lg border px-3 py-2 text-sm',
28
+ dark ? 'border-white/[0.06] bg-white/[0.03]' : 'border-gray-200 bg-gray-50']">
24
29
  <span>{{ iconForMime(attachment.mime_type) }}</span>
25
- <a :href="attachment.url" target="_blank" class="flex-1 truncate font-medium text-blue-600 hover:underline">
30
+ <a :href="attachment.url" target="_blank"
31
+ :class="['flex-1 truncate font-medium hover:underline', dark ? 'text-white' : 'text-blue-600']">
26
32
  {{ attachment.original_filename }}
27
33
  </a>
28
- <span class="text-xs text-gray-400">{{ formatSize(attachment.size) }}</span>
34
+ <span :class="['text-xs', dark ? 'text-neutral-500' : 'text-gray-400']">{{ formatSize(attachment.size) }}</span>
29
35
  </div>
30
36
  </div>
31
37
  </template>
@@ -1,213 +1,219 @@
1
- <script setup>
2
- import { computed, inject } from 'vue';
3
- import { usePage, Link } from '@inertiajs/vue3';
4
-
5
- const props = defineProps({
6
- title: { type: String, default: 'Support' },
7
- });
8
-
9
- const page = usePage();
10
- const staticLayout = inject('escalated-layout', null);
11
- const layoutResolver = inject('escalated-layout-resolver', null);
12
-
13
- const hostLayout = computed(() => {
14
- if (layoutResolver) return layoutResolver();
15
- return staticLayout;
16
- });
17
-
18
- const isAgent = computed(() => page.props.escalated?.is_agent);
19
- const isAdmin = computed(() => page.props.escalated?.is_admin);
20
- const prefix = computed(() => {
21
- const p = page.props.escalated?.prefix || 'support';
22
- return p.startsWith('/') ? p : `/${p}`;
23
- });
24
-
25
- const currentUrl = computed(() => page.url);
26
- const isAdminSection = computed(() => currentUrl.value?.includes('/admin'));
27
- const isAgentSection = computed(() => currentUrl.value?.includes('/agent'));
28
-
29
- const adminLinks = computed(() => [
30
- { href: `${prefix.value}/admin/reports`, label: 'Reports', icon: 'chart' },
31
- { href: `${prefix.value}/admin/departments`, label: 'Departments', icon: 'grid' },
32
- { href: `${prefix.value}/admin/sla-policies`, label: 'SLA Policies', icon: 'clock' },
33
- { href: `${prefix.value}/admin/escalation-rules`, label: 'Escalation Rules', icon: 'arrow' },
34
- { href: `${prefix.value}/admin/tags`, label: 'Tags', icon: 'tag' },
35
- { href: `${prefix.value}/admin/canned-responses`, label: 'Canned Responses', icon: 'message' },
36
- ]);
37
-
38
- const agentLinks = computed(() => [
39
- { href: `${prefix.value}/agent`, label: 'Dashboard' },
40
- { href: `${prefix.value}/agent/tickets`, label: 'Tickets' },
41
- ]);
42
-
43
- const userName = computed(() => page.props.auth?.user?.name || 'User');
44
- const userInitial = computed(() => userName.value.charAt(0).toUpperCase());
45
-
46
- function isActive(href) {
47
- if (!currentUrl.value) return false;
48
- return currentUrl.value === href || currentUrl.value.startsWith(href + '/');
49
- }
50
- </script>
51
-
52
- <template>
53
- <!-- MODE 1: Host layout provided (customer pages within host app) -->
54
- <component :is="hostLayout" v-if="hostLayout">
55
- <template #header>
56
- <div class="flex items-center justify-between">
57
- <h2 class="esc-heading text-xl font-semibold leading-tight text-gray-800">{{ title }}</h2>
58
- <nav class="flex items-center gap-4 text-sm">
59
- <Link :href="prefix" class="text-gray-600 hover:text-gray-900">My Tickets</Link>
60
- <Link v-if="isAgent" :href="`${prefix}/agent`" class="text-gray-600 hover:text-gray-900">Agent Panel</Link>
61
- <Link v-if="isAdmin" :href="`${prefix}/admin/reports`" class="text-gray-600 hover:text-gray-900">Admin</Link>
62
- </nav>
63
- </div>
64
- </template>
65
-
66
- <div class="mx-auto max-w-7xl px-4 py-6 sm:px-6 lg:px-8">
67
- <slot />
68
- </div>
69
- </component>
70
-
71
- <!-- MODE 2: Admin standalone — dark sidebar layout -->
72
- <div v-else-if="isAdminSection" class="esc-root flex min-h-screen bg-gray-950">
73
- <!-- Sidebar -->
74
- <aside class="fixed inset-y-0 left-0 z-30 flex w-64 flex-col border-r border-white/10 bg-gray-900">
75
- <!-- Logo -->
76
- <div class="flex h-16 items-center gap-3 px-6">
77
- <div class="flex h-8 w-8 items-center justify-center rounded-lg bg-gradient-to-br from-orange-500 via-cyan-500 to-violet-500">
78
- <svg class="h-4 w-4 text-white" fill="none" stroke="currentColor" stroke-width="2.5" viewBox="0 0 24 24">
79
- <path stroke-linecap="round" stroke-linejoin="round" d="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z" />
80
- </svg>
81
- </div>
82
- <span class="text-lg font-bold text-white">Escalated</span>
83
- <span class="rounded bg-white/10 px-1.5 py-0.5 text-[10px] font-medium text-gray-400">Admin</span>
84
- </div>
85
-
86
- <!-- Nav -->
87
- <nav class="mt-2 flex-1 space-y-1 px-3">
88
- <Link v-for="link in adminLinks" :key="link.href" :href="link.href"
89
- :class="['group flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all',
90
- isActive(link.href)
91
- ? 'bg-gradient-to-r from-orange-500/20 via-cyan-500/20 to-violet-500/20 text-white ring-1 ring-white/10'
92
- : 'text-gray-400 hover:bg-white/5 hover:text-white']">
93
- {{ link.label }}
94
- </Link>
95
- </nav>
96
-
97
- <!-- Bottom -->
98
- <div class="border-t border-white/10 p-4">
99
- <Link v-if="isAgent" :href="`${prefix}/agent`"
100
- class="flex items-center gap-2 rounded-lg px-3 py-2 text-sm text-gray-400 transition-colors hover:bg-white/5 hover:text-white">
101
- <svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M9 15L3 9m0 0l6-6M3 9h12a6 6 0 010 12h-3" /></svg>
102
- Agent Panel
103
- </Link>
104
- <Link :href="prefix"
105
- class="flex items-center gap-2 rounded-lg px-3 py-2 text-sm text-gray-400 transition-colors hover:bg-white/5 hover:text-white">
106
- <svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9" /></svg>
107
- Back to App
108
- </Link>
109
- </div>
110
- </aside>
111
-
112
- <!-- Main content -->
113
- <div class="flex flex-1 flex-col pl-64">
114
- <!-- Top bar -->
115
- <header class="sticky top-0 z-20 flex h-16 items-center justify-between border-b border-white/10 bg-gray-900/80 px-6 backdrop-blur-xl">
116
- <h1 class="text-lg font-semibold text-white">{{ title }}</h1>
117
- <div class="flex items-center gap-3">
118
- <div class="flex h-8 w-8 items-center justify-center rounded-full bg-gradient-to-br from-cyan-500 to-violet-500 text-xs font-bold text-white">
119
- {{ userInitial }}
120
- </div>
121
- <span class="text-sm text-gray-300">{{ userName }}</span>
122
- </div>
123
- </header>
124
-
125
- <!-- Page content -->
126
- <main class="flex-1 p-4">
127
- <div class="rounded-xl bg-white p-6 shadow-sm ring-1 ring-gray-950/5">
128
- <slot />
129
- </div>
130
- </main>
131
- </div>
132
- </div>
133
-
134
- <!-- MODE 3: Agent standalone — dark top-nav layout -->
135
- <div v-else-if="isAgentSection" class="esc-root min-h-screen bg-gray-950">
136
- <!-- Top nav -->
137
- <nav class="sticky top-0 z-30 border-b border-white/10 bg-gray-900">
138
- <div class="mx-auto flex h-16 max-w-7xl items-center justify-between px-4 sm:px-6 lg:px-8">
139
- <!-- Left: branding -->
140
- <div class="flex items-center gap-3">
141
- <div class="flex h-8 w-8 items-center justify-center rounded-lg bg-gradient-to-br from-orange-500 via-cyan-500 to-violet-500">
142
- <svg class="h-4 w-4 text-white" fill="none" stroke="currentColor" stroke-width="2.5" viewBox="0 0 24 24">
143
- <path stroke-linecap="round" stroke-linejoin="round" d="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z" />
144
- </svg>
145
- </div>
146
- <span class="text-lg font-bold text-white">Escalated</span>
147
- </div>
148
-
149
- <!-- Center: nav links -->
150
- <div class="flex items-center gap-1">
151
- <Link v-for="link in agentLinks" :key="link.href" :href="link.href"
152
- :class="['rounded-lg px-4 py-2 text-sm font-medium transition-all',
153
- isActive(link.href)
154
- ? 'bg-gradient-to-r from-orange-500/20 via-cyan-500/20 to-violet-500/20 text-white ring-1 ring-white/10'
155
- : 'text-gray-400 hover:bg-white/5 hover:text-white']">
156
- {{ link.label }}
157
- </Link>
158
- </div>
159
-
160
- <!-- Right: user + back -->
161
- <div class="flex items-center gap-4">
162
- <div class="flex items-center gap-2">
163
- <div class="flex h-7 w-7 items-center justify-center rounded-full bg-gradient-to-br from-cyan-500 to-violet-500 text-xs font-bold text-white">
164
- {{ userInitial }}
165
- </div>
166
- <span class="text-sm text-gray-300">{{ userName }}</span>
167
- </div>
168
- <div class="h-5 w-px bg-white/10"></div>
169
- <Link v-if="isAdmin" :href="`${prefix}/admin/reports`"
170
- class="text-sm text-gray-400 transition-colors hover:text-white">
171
- Admin
172
- </Link>
173
- <Link :href="prefix"
174
- class="text-sm text-gray-400 transition-colors hover:text-white">
175
- Back to App
176
- </Link>
177
- </div>
178
- </div>
179
- <!-- Rainbow accent line -->
180
- <div class="h-px bg-gradient-to-r from-orange-500 via-cyan-500 to-violet-500"></div>
181
- </nav>
182
-
183
- <!-- Page content -->
184
- <main class="mx-auto max-w-7xl px-4 py-6 sm:px-6 lg:px-8">
185
- <div class="rounded-xl bg-white p-6 shadow-sm ring-1 ring-gray-950/5">
186
- <slot />
187
- </div>
188
- </main>
189
- </div>
190
-
191
- <!-- MODE 4: Customer standalone fallback (no host layout, not admin/agent) -->
192
- <div v-else class="esc-root min-h-screen bg-gray-50">
193
- <nav class="border-b border-gray-200 bg-white">
194
- <div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
195
- <div class="flex h-14 items-center justify-between">
196
- <div class="flex items-center gap-6">
197
- <span class="text-lg font-bold text-gray-900">{{ title }}</span>
198
- <div class="flex items-center gap-4 text-sm">
199
- <Link :href="prefix" class="text-gray-600 hover:text-gray-900">My Tickets</Link>
200
- <Link v-if="isAgent" :href="`${prefix}/agent`" class="text-gray-600 hover:text-gray-900">Agent Panel</Link>
201
- <Link v-if="isAdmin" :href="`${prefix}/admin/reports`" class="text-gray-600 hover:text-gray-900">Admin</Link>
202
- </div>
203
- </div>
204
- </div>
205
- </div>
206
- </nav>
207
- <main class="flex-1">
208
- <div class="mx-auto max-w-7xl px-4 py-6 sm:px-6 lg:px-8">
209
- <slot />
210
- </div>
211
- </main>
212
- </div>
213
- </template>
1
+ <script setup>
2
+ import { computed, inject, provide } from 'vue';
3
+ import { usePage, Link } from '@inertiajs/vue3';
4
+
5
+ const props = defineProps({
6
+ title: { type: String, default: 'Support' },
7
+ });
8
+
9
+ const page = usePage();
10
+ const hostLayout = inject('escalated-layout', null);
11
+
12
+ const isAgent = computed(() => page.props.escalated?.is_agent);
13
+ const isAdmin = computed(() => page.props.escalated?.is_admin);
14
+ const prefix = computed(() => {
15
+ const p = page.props.escalated?.prefix || 'support';
16
+ return p.startsWith('/') ? p : `/${p}`;
17
+ });
18
+
19
+ const currentUrl = computed(() => page.url);
20
+ const isAdminSection = computed(() => currentUrl.value?.includes('/admin'));
21
+ const isAgentSection = computed(() => currentUrl.value?.includes('/agent'));
22
+ const isDark = computed(() => isAdminSection.value || isAgentSection.value);
23
+
24
+ provide('esc-dark', isDark);
25
+
26
+ const adminLinks = computed(() => [
27
+ { href: `${prefix.value}/admin/reports`, label: 'Reports', icon: 'M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 013 19.875v-6.75zM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V8.625zM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V4.125z' },
28
+ { href: `${prefix.value}/admin/tickets`, label: 'Tickets', icon: 'M16.5 6v.75m0 3v.75m0 3v.75m0 3V18m-9-5.25h5.25M7.5 15h3M3.375 5.25c-.621 0-1.125.504-1.125 1.125v3.026a2.999 2.999 0 010 5.198v3.026c0 .621.504 1.125 1.125 1.125h17.25c.621 0 1.125-.504 1.125-1.125v-3.026a2.999 2.999 0 010-5.198V6.375c0-.621-.504-1.125-1.125-1.125H3.375z' },
29
+ { href: `${prefix.value}/admin/departments`, label: 'Departments', icon: 'M2.25 7.125C2.25 6.504 2.754 6 3.375 6h6c.621 0 1.125.504 1.125 1.125v3.75c0 .621-.504 1.125-1.125 1.125h-6a1.125 1.125 0 01-1.125-1.125v-3.75zM14.25 8.625c0-.621.504-1.125 1.125-1.125h5.25c.621 0 1.125.504 1.125 1.125v8.25c0 .621-.504 1.125-1.125 1.125h-5.25a1.125 1.125 0 01-1.125-1.125v-8.25zM3.75 16.125c0-.621.504-1.125 1.125-1.125h5.25c.621 0 1.125.504 1.125 1.125v2.25c0 .621-.504 1.125-1.125 1.125h-5.25a1.125 1.125 0 01-1.125-1.125v-2.25z' },
30
+ { href: `${prefix.value}/admin/sla-policies`, label: 'SLA Policies', icon: 'M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z' },
31
+ { href: `${prefix.value}/admin/escalation-rules`, label: 'Escalation Rules', icon: 'M3 4.5h14.25M3 9h9.75M3 13.5h5.25m5.25-.75L17.25 9m0 0L21 12.75M17.25 9v12' },
32
+ { href: `${prefix.value}/admin/tags`, label: 'Tags', icon: 'M9.568 3H5.25A2.25 2.25 0 003 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 005.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 009.568 3z M6 6h.008v.008H6V6z' },
33
+ { href: `${prefix.value}/admin/canned-responses`, label: 'Canned Responses', icon: 'M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 01.865-.501 48.172 48.172 0 003.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0012 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018z' },
34
+ { href: `${prefix.value}/admin/settings`, label: 'Settings', icon: 'M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.204-.107-.397.165-.71.505-.781.93l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894zM15 12a3 3 0 11-6 0 3 3 0 016 0z' },
35
+ ]);
36
+
37
+ const agentLinks = computed(() => [
38
+ { href: `${prefix.value}/agent`, label: 'Dashboard', icon: 'M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25' },
39
+ { href: `${prefix.value}/agent/tickets`, label: 'Tickets', icon: 'M16.5 6v.75m0 3v.75m0 3v.75m0 3V18m-9-5.25h5.25M7.5 15h3M3.375 5.25c-.621 0-1.125.504-1.125 1.125v3.026a2.999 2.999 0 010 5.198v3.026c0 .621.504 1.125 1.125 1.125h17.25c.621 0 1.125-.504 1.125-1.125v-3.026a2.999 2.999 0 010-5.198V6.375c0-.621-.504-1.125-1.125-1.125H3.375z' },
40
+ ]);
41
+
42
+ const userName = computed(() => page.props.auth?.user?.name || 'User');
43
+ const userInitial = computed(() => userName.value.charAt(0).toUpperCase());
44
+
45
+ function isActive(href) {
46
+ if (!currentUrl.value) return false;
47
+ return currentUrl.value === href || currentUrl.value.startsWith(href + '/');
48
+ }
49
+ </script>
50
+
51
+ <template>
52
+ <!-- MODE 1: Admin — dark sidebar layout -->
53
+ <div v-if="isAdminSection" class="flex min-h-screen bg-black" style="color-scheme: dark">
54
+ <!-- Sidebar -->
55
+ <aside class="fixed inset-y-0 left-0 z-30 flex w-64 flex-col border-r border-white/[0.06] bg-neutral-950">
56
+ <!-- Logo -->
57
+ <div class="flex h-16 items-center gap-3 px-5">
58
+ <div class="flex h-9 w-9 items-center justify-center rounded-lg bg-white/10">
59
+ <svg class="h-5 w-5" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
60
+ <defs><linearGradient id="esc-rainbow-admin" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" stop-color="#f97316"/><stop offset="30%" stop-color="#eab308"/><stop offset="50%" stop-color="#22c55e"/><stop offset="70%" stop-color="#3b82f6"/><stop offset="100%" stop-color="#8b5cf6"/></linearGradient></defs>
61
+ <g transform="translate(12,12) scale(1.35) translate(-12,-12)"><polyline points="17 11 12 6 7 11" stroke="url(#esc-rainbow-admin)"/><polyline points="17 18 12 13 7 18" stroke="url(#esc-rainbow-admin)"/></g>
62
+ </svg>
63
+ </div>
64
+ <div>
65
+ <span class="text-sm font-bold text-white tracking-wide">Escalated</span>
66
+ <span class="ml-1.5 rounded bg-white/[0.08] px-1.5 py-0.5 text-[10px] font-semibold text-neutral-500">ADMIN</span>
67
+ </div>
68
+ </div>
69
+
70
+ <!-- Nav -->
71
+ <nav class="mt-1 flex-1 space-y-0.5 overflow-y-auto px-3">
72
+ <Link v-for="link in adminLinks" :key="link.href" :href="link.href"
73
+ :class="['group flex items-center gap-3 rounded-lg px-3 py-2 text-[13px] font-medium transition-all',
74
+ isActive(link.href)
75
+ ? 'bg-white/[0.08] text-white'
76
+ : 'text-neutral-500 hover:bg-white/[0.04] hover:text-neutral-300']">
77
+ <svg :class="['h-[18px] w-[18px] shrink-0', isActive(link.href) ? 'text-white' : 'text-neutral-600 group-hover:text-neutral-400']"
78
+ fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
79
+ <path stroke-linecap="round" stroke-linejoin="round" :d="link.icon" />
80
+ </svg>
81
+ {{ link.label }}
82
+ </Link>
83
+ </nav>
84
+
85
+ <!-- Bottom section -->
86
+ <div class="border-t border-white/[0.06] p-3">
87
+ <Link v-if="isAgent" :href="`${prefix}/agent`"
88
+ class="flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-neutral-500 transition-colors hover:bg-white/[0.04] hover:text-neutral-300">
89
+ <svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M9 15L3 9m0 0l6-6M3 9h12a6 6 0 010 12h-3" /></svg>
90
+ Agent Panel
91
+ </Link>
92
+ <Link :href="prefix"
93
+ class="flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-neutral-500 transition-colors hover:bg-white/[0.04] hover:text-neutral-300">
94
+ <svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9" /></svg>
95
+ Back to App
96
+ </Link>
97
+
98
+ <!-- User -->
99
+ <div class="mt-2 flex items-center gap-3 rounded-lg bg-white/[0.03] px-3 py-2.5">
100
+ <div class="flex h-7 w-7 items-center justify-center rounded-md bg-white/[0.08] text-xs font-semibold text-neutral-400">
101
+ {{ userInitial }}
102
+ </div>
103
+ <span class="text-sm text-neutral-400">{{ userName }}</span>
104
+ </div>
105
+ </div>
106
+ </aside>
107
+
108
+ <!-- Main content -->
109
+ <div class="flex flex-1 flex-col pl-64">
110
+ <!-- Top bar -->
111
+ <header class="sticky top-0 z-20 flex h-14 items-center border-b border-white/[0.06] bg-black/80 px-6 backdrop-blur-xl">
112
+ <h1 class="text-sm font-semibold text-white">{{ title }}</h1>
113
+ </header>
114
+
115
+ <!-- Page content -->
116
+ <main class="flex-1 p-6">
117
+ <slot />
118
+ </main>
119
+ </div>
120
+ </div>
121
+
122
+ <!-- MODE 2: Agent — dark top-nav layout -->
123
+ <div v-else-if="isAgentSection" class="min-h-screen bg-black" style="color-scheme: dark">
124
+ <!-- Top nav -->
125
+ <nav class="sticky top-0 z-30 border-b border-white/[0.06] bg-neutral-950/95 backdrop-blur-xl">
126
+ <div class="mx-auto flex h-14 max-w-7xl items-center justify-between px-4 sm:px-6 lg:px-8">
127
+ <!-- Left: branding -->
128
+ <div class="flex items-center gap-3">
129
+ <div class="flex h-8 w-8 items-center justify-center rounded-lg bg-white/10">
130
+ <svg class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
131
+ <defs><linearGradient id="esc-rainbow-agent" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" stop-color="#f97316"/><stop offset="30%" stop-color="#eab308"/><stop offset="50%" stop-color="#22c55e"/><stop offset="70%" stop-color="#3b82f6"/><stop offset="100%" stop-color="#8b5cf6"/></linearGradient></defs>
132
+ <g transform="translate(12,12) scale(1.35) translate(-12,-12)"><polyline points="17 11 12 6 7 11" stroke="url(#esc-rainbow-agent)"/><polyline points="17 18 12 13 7 18" stroke="url(#esc-rainbow-agent)"/></g>
133
+ </svg>
134
+ </div>
135
+ <span class="text-sm font-bold text-white tracking-wide">Escalated</span>
136
+ </div>
137
+
138
+ <!-- Center: nav links -->
139
+ <div class="flex items-center gap-1">
140
+ <Link v-for="link in agentLinks" :key="link.href" :href="link.href"
141
+ :class="['flex items-center gap-2 rounded-lg px-3.5 py-1.5 text-[13px] font-medium transition-all',
142
+ isActive(link.href)
143
+ ? 'bg-white/[0.08] text-white'
144
+ : 'text-neutral-500 hover:bg-white/[0.04] hover:text-neutral-300']">
145
+ <svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
146
+ <path stroke-linecap="round" stroke-linejoin="round" :d="link.icon" />
147
+ </svg>
148
+ {{ link.label }}
149
+ </Link>
150
+ </div>
151
+
152
+ <!-- Right: user + links -->
153
+ <div class="flex items-center gap-3">
154
+ <Link v-if="isAdmin" :href="`${prefix}/admin/reports`"
155
+ class="text-[13px] text-neutral-500 transition-colors hover:text-white">
156
+ Admin
157
+ </Link>
158
+ <Link :href="prefix"
159
+ class="text-[13px] text-neutral-500 transition-colors hover:text-white">
160
+ Back to App
161
+ </Link>
162
+ <div class="ml-1 h-5 w-px bg-white/[0.08]"></div>
163
+ <div class="flex items-center gap-2">
164
+ <div class="flex h-7 w-7 items-center justify-center rounded-md bg-white/[0.08] text-[10px] font-semibold text-neutral-400">
165
+ {{ userInitial }}
166
+ </div>
167
+ <span class="text-[13px] text-neutral-400">{{ userName }}</span>
168
+ </div>
169
+ </div>
170
+ </div>
171
+ </nav>
172
+
173
+ <!-- Page content -->
174
+ <main class="mx-auto max-w-7xl px-4 py-6 sm:px-6 lg:px-8">
175
+ <slot />
176
+ </main>
177
+ </div>
178
+
179
+ <!-- MODE 3: Customer pages — use host app layout if provided -->
180
+ <component :is="hostLayout" v-else-if="hostLayout">
181
+ <template #header>
182
+ <div class="flex items-center justify-between">
183
+ <h2 class="text-xl font-semibold leading-tight text-gray-800">{{ title }}</h2>
184
+ <nav class="flex items-center gap-4 text-sm">
185
+ <Link :href="prefix" class="text-gray-600 hover:text-gray-900">My Tickets</Link>
186
+ <Link v-if="isAgent" :href="`${prefix}/agent`" class="text-gray-600 hover:text-gray-900">Agent Panel</Link>
187
+ <Link v-if="isAdmin" :href="`${prefix}/admin/reports`" class="text-gray-600 hover:text-gray-900">Admin</Link>
188
+ </nav>
189
+ </div>
190
+ </template>
191
+
192
+ <div class="mx-auto max-w-7xl px-4 py-6 sm:px-6 lg:px-8">
193
+ <slot />
194
+ </div>
195
+ </component>
196
+
197
+ <!-- MODE 4: Customer standalone fallback (no host layout) -->
198
+ <div v-else class="min-h-screen bg-gray-50">
199
+ <nav class="border-b border-gray-200 bg-white">
200
+ <div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
201
+ <div class="flex h-14 items-center justify-between">
202
+ <div class="flex items-center gap-6">
203
+ <span class="text-lg font-bold text-gray-900">{{ title }}</span>
204
+ <div class="flex items-center gap-4 text-sm">
205
+ <Link :href="prefix" class="text-gray-600 hover:text-gray-900">My Tickets</Link>
206
+ <Link v-if="isAgent" :href="`${prefix}/agent`" class="text-gray-600 hover:text-gray-900">Agent Panel</Link>
207
+ <Link v-if="isAdmin" :href="`${prefix}/admin/reports`" class="text-gray-600 hover:text-gray-900">Admin</Link>
208
+ </div>
209
+ </div>
210
+ </div>
211
+ </div>
212
+ </nav>
213
+ <main class="flex-1">
214
+ <div class="mx-auto max-w-7xl px-4 py-6 sm:px-6 lg:px-8">
215
+ <slot />
216
+ </div>
217
+ </main>
218
+ </div>
219
+ </template>
@@ -1,7 +1,8 @@
1
1
  <script setup>
2
- import { ref } from 'vue';
2
+ import { ref, computed, inject } from 'vue';
3
3
 
4
4
  const emit = defineEmits(['files']);
5
+ const dark = inject('esc-dark', computed(() => false));
5
6
 
6
7
  const dragging = ref(false);
7
8
  const fileInput = ref(null);
@@ -27,10 +28,14 @@ function browse() {
27
28
 
28
29
  <template>
29
30
  <div @dragover.prevent="dragging = true" @dragleave="dragging = false" @drop.prevent="onDrop"
30
- :class="['cursor-pointer rounded-md border-2 border-dashed px-4 py-3 text-center text-xs transition-colors',
31
- dragging ? 'border-blue-400 bg-blue-50' : 'border-gray-300 hover:border-gray-400']"
31
+ :class="['cursor-pointer rounded-lg border-2 border-dashed px-4 py-3 text-center text-xs transition-colors',
32
+ dark
33
+ ? (dragging ? 'border-white/20 bg-white/[0.04]' : 'border-white/[0.08] hover:border-white/[0.12]')
34
+ : (dragging ? 'border-blue-400 bg-blue-50' : 'border-gray-300 hover:border-gray-400')]"
32
35
  @click="browse">
33
- <p class="text-gray-500">Drop files here or <span class="font-medium text-blue-600">browse</span></p>
36
+ <p :class="dark ? 'text-neutral-500' : 'text-gray-500'">
37
+ Drop files here or <span :class="['font-medium', dark ? 'text-white' : 'text-blue-600']">browse</span>
38
+ </p>
34
39
  <input ref="fileInput" type="file" multiple class="hidden" @change="onFileSelect" />
35
40
  </div>
36
41
  </template>