@escalated-dev/escalated 0.8.0 → 0.9.0

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 (116) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +380 -361
  3. package/package.json +85 -84
  4. package/src/components/ActiveChatsPanel.vue +246 -246
  5. package/src/components/AdminDashboard.stories.js +1423 -1423
  6. package/src/components/AttachmentList.vue +65 -65
  7. package/src/components/ChatActionBar.vue +226 -226
  8. package/src/components/ChatBubble.vue +162 -162
  9. package/src/components/ChatComposer.vue +308 -308
  10. package/src/components/ChatQueue.vue +222 -222
  11. package/src/components/ChatThread.vue +197 -197
  12. package/src/components/CustomTicketActions.stories.js +71 -0
  13. package/src/components/CustomTicketActions.vue +101 -0
  14. package/src/components/EscalatedLayout.vue +619 -604
  15. package/src/components/FollowButton.vue +20 -1
  16. package/src/components/MentionDropdown.vue +154 -154
  17. package/src/components/MetricComparison.vue +89 -89
  18. package/src/components/PercentileChart.vue +67 -67
  19. package/src/components/PeriodSelector.vue +98 -98
  20. package/src/components/PresenceIndicator.vue +228 -213
  21. package/src/components/ReplyComposer.vue +336 -336
  22. package/src/components/ReplyThread.vue +153 -153
  23. package/src/components/ReportChart.vue +395 -395
  24. package/src/components/ReportExportButton.vue +108 -108
  25. package/src/components/SaveViewDialog.vue +172 -172
  26. package/src/components/SavedViewSidebar.vue +208 -208
  27. package/src/components/SkillTagManager.vue +3 -0
  28. package/src/components/SnoozeButton.vue +247 -247
  29. package/src/components/TicketFilters.vue +270 -270
  30. package/src/components/TicketList.vue +655 -655
  31. package/src/components/TicketSidebar.vue +4 -0
  32. package/src/components/TicketSplitDialog.vue +98 -98
  33. package/src/components/TicketSubjects.stories.js +63 -0
  34. package/src/components/TicketSubjects.vue +107 -0
  35. package/src/components/TwoFactorSetup.vue +1 -37
  36. package/src/components/VariableTokenInput.vue +111 -111
  37. package/src/components/WorkflowActionConfig.vue +287 -287
  38. package/src/components/WorkflowActionList.vue +350 -350
  39. package/src/components/WorkflowConditionBuilder.vue +265 -265
  40. package/src/components/WorkflowTriggerSelector.vue +125 -125
  41. package/src/components/admin/newsletters/AnalyticsTiles.stories.js +14 -0
  42. package/src/components/admin/newsletters/AnalyticsTiles.vue +55 -0
  43. package/src/components/admin/newsletters/DeliveriesTable.stories.js +28 -0
  44. package/src/components/admin/newsletters/DeliveriesTable.vue +104 -0
  45. package/src/components/admin/newsletters/DynamicFilterBuilder.stories.js +11 -0
  46. package/src/components/admin/newsletters/DynamicFilterBuilder.vue +53 -0
  47. package/src/components/admin/newsletters/ListMemberTable.stories.js +12 -0
  48. package/src/components/admin/newsletters/ListMemberTable.vue +53 -0
  49. package/src/components/admin/newsletters/MarkdownEditor.stories.js +6 -0
  50. package/src/components/admin/newsletters/MarkdownEditor.vue +53 -0
  51. package/src/components/admin/newsletters/MergeFieldDropdown.stories.js +6 -0
  52. package/src/components/admin/newsletters/MergeFieldDropdown.vue +84 -0
  53. package/src/components/admin/newsletters/PreviewIframe.stories.js +7 -0
  54. package/src/components/admin/newsletters/PreviewIframe.vue +40 -0
  55. package/src/components/admin/newsletters/SummaryTiles.stories.js +8 -0
  56. package/src/components/admin/newsletters/SummaryTiles.vue +63 -0
  57. package/src/composables/useChat.js +187 -187
  58. package/src/composables/useI18n.js +102 -102
  59. package/src/composables/useMentions.js +134 -134
  60. package/src/composables/usePermissions.js +31 -0
  61. package/src/composables/useRealtime.js +182 -182
  62. package/src/index.js +85 -84
  63. package/src/locales/README.md +13 -13
  64. package/src/locales/ar.json +727 -727
  65. package/src/locales/de.json +690 -690
  66. package/src/locales/en.json +889 -729
  67. package/src/locales/es.json +691 -691
  68. package/src/locales/fr.json +691 -691
  69. package/src/locales/index.js +16 -16
  70. package/src/locales/it.json +727 -727
  71. package/src/locales/ja.json +727 -727
  72. package/src/locales/ko.json +727 -727
  73. package/src/locales/nl.json +727 -727
  74. package/src/locales/pl.json +727 -727
  75. package/src/locales/pt-BR.json +727 -727
  76. package/src/locales/ru.json +727 -727
  77. package/src/locales/tr.json +727 -727
  78. package/src/locales/zh-CN.json +727 -727
  79. package/src/pages/Admin/Newsletters/Compose.vue +192 -0
  80. package/src/pages/Admin/Newsletters/Edit.vue +24 -0
  81. package/src/pages/Admin/Newsletters/Index.vue +141 -0
  82. package/src/pages/Admin/Newsletters/Lists/Create.vue +64 -0
  83. package/src/pages/Admin/Newsletters/Lists/Index.vue +59 -0
  84. package/src/pages/Admin/Newsletters/Lists/Show.vue +53 -0
  85. package/src/pages/Admin/Newsletters/Settings.vue +85 -0
  86. package/src/pages/Admin/Newsletters/Show.vue +140 -0
  87. package/src/pages/Admin/Newsletters/Templates/Create.vue +11 -0
  88. package/src/pages/Admin/Newsletters/Templates/Index.vue +54 -0
  89. package/src/pages/Admin/Newsletters/Templates/Show.vue +65 -0
  90. package/src/pages/Admin/Newsletters/usePreview.js +44 -0
  91. package/src/pages/Admin/Reports/AgentDetail.vue +132 -132
  92. package/src/pages/Admin/Reports/AgentRanking.vue +246 -246
  93. package/src/pages/Admin/Reports/Cohorts.vue +180 -180
  94. package/src/pages/Admin/Reports/Comparison.vue +141 -141
  95. package/src/pages/Admin/Reports/Dashboard.vue +226 -226
  96. package/src/pages/Admin/Reports/ResolutionTimes.vue +164 -164
  97. package/src/pages/Admin/Reports/ResponseTimes.vue +164 -164
  98. package/src/pages/Admin/Reports/SlaTrends.vue +183 -183
  99. package/src/pages/Admin/Settings/SsoSettings.vue +157 -4
  100. package/src/pages/Admin/Settings/TwoFactor.vue +32 -6
  101. package/src/pages/Admin/Settings.vue +1008 -1008
  102. package/src/pages/Admin/Skills/Form.vue +30 -10
  103. package/src/pages/Admin/Tickets/Index.vue +126 -126
  104. package/src/pages/Admin/Tickets/Show.vue +254 -249
  105. package/src/pages/Admin/Users/Index.vue +145 -145
  106. package/src/pages/Admin/Workflows/Builder.vue +207 -207
  107. package/src/pages/Admin/Workflows/Index.vue +235 -235
  108. package/src/pages/Admin/Workflows/Logs.vue +286 -286
  109. package/src/pages/Agent/TicketIndex.vue +112 -112
  110. package/src/pages/Agent/TicketShow.vue +547 -494
  111. package/src/pages/Customer/Index.vue +56 -56
  112. package/src/pages/Customer/KnowledgeBase/Article.vue +129 -129
  113. package/src/plugin.js +175 -175
  114. package/src/utils/mentionHighlight.js +24 -24
  115. package/src/widget/EscalatedWidget.vue +804 -804
  116. package/src/widget/index.js +254 -254
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { ref, computed, inject } from 'vue';
2
+ import { ref, computed, inject, watch } from 'vue';
3
3
  import { router } from '@inertiajs/vue3';
4
4
 
5
5
  const props = defineProps({
@@ -16,6 +16,25 @@ const following = ref(props.isFollowing);
16
16
  const count = ref(props.followersCount);
17
17
  const processing = ref(false);
18
18
 
19
+ // Re-sync local state when the props change. Inertia reuses this component
20
+ // instance when navigating between tickets (Vue does not re-run setup), so the
21
+ // refs above are only seeded from the FIRST ticket's props. Without these
22
+ // watchers the button shows a stale follow state — e.g. an already-followed
23
+ // ticket renders as "Follow" — and the optimistic toggle below would also
24
+ // drift from the server's authoritative value after a reload.
25
+ watch(
26
+ () => props.isFollowing,
27
+ (value) => {
28
+ following.value = value;
29
+ },
30
+ );
31
+ watch(
32
+ () => props.followersCount,
33
+ (value) => {
34
+ count.value = value;
35
+ },
36
+ );
37
+
19
38
  function toggle() {
20
39
  if (processing.value) return;
21
40
  processing.value = true;
@@ -1,154 +1,154 @@
1
- <script setup>
2
- import { ref, computed, inject, watch, nextTick } from 'vue';
3
-
4
- const props = defineProps({
5
- suggestions: { type: Array, default: () => [] },
6
- visible: { type: Boolean, default: false },
7
- loading: { type: Boolean, default: false },
8
- });
9
-
10
- const emit = defineEmits(['select', 'close']);
11
-
12
- const escDark = inject(
13
- 'esc-dark',
14
- computed(() => false),
15
- );
16
-
17
- const activeIndex = ref(0);
18
- const listRef = ref(null);
19
-
20
- // Reset active index when suggestions change
21
- watch(
22
- () => props.suggestions,
23
- () => {
24
- activeIndex.value = 0;
25
- },
26
- );
27
-
28
- function scrollActiveIntoView() {
29
- nextTick(() => {
30
- const list = listRef.value;
31
- if (!list) return;
32
- const item = list.children[activeIndex.value];
33
- if (item) {
34
- item.scrollIntoView({ block: 'nearest' });
35
- }
36
- });
37
- }
38
-
39
- function onKeydown(e) {
40
- if (!props.visible) return false;
41
-
42
- if (e.key === 'ArrowDown') {
43
- e.preventDefault();
44
- activeIndex.value = (activeIndex.value + 1) % props.suggestions.length;
45
- scrollActiveIntoView();
46
- return true;
47
- }
48
-
49
- if (e.key === 'ArrowUp') {
50
- e.preventDefault();
51
- activeIndex.value = (activeIndex.value - 1 + props.suggestions.length) % props.suggestions.length;
52
- scrollActiveIntoView();
53
- return true;
54
- }
55
-
56
- if (e.key === 'Enter' || e.key === 'Tab') {
57
- if (props.suggestions.length > 0) {
58
- e.preventDefault();
59
- emit('select', props.suggestions[activeIndex.value]);
60
- return true;
61
- }
62
- }
63
-
64
- if (e.key === 'Escape') {
65
- e.preventDefault();
66
- emit('close');
67
- return true;
68
- }
69
-
70
- return false;
71
- }
72
-
73
- function selectAgent(agent) {
74
- emit('select', agent);
75
- }
76
-
77
- defineExpose({ onKeydown });
78
- </script>
79
-
80
- <template>
81
- <div
82
- v-if="visible && (suggestions.length > 0 || loading)"
83
- :class="[
84
- 'absolute z-50 w-64 max-h-48 overflow-y-auto rounded-lg border shadow-lg',
85
- escDark ? 'border-white/10 bg-neutral-900 shadow-black/40' : 'border-gray-200 bg-white shadow-gray-200/50',
86
- ]"
87
- role="listbox"
88
- aria-label="Agent suggestions"
89
- >
90
- <!-- Loading state -->
91
- <div
92
- v-if="loading && suggestions.length === 0"
93
- :class="['px-3 py-2 text-xs', escDark ? 'text-neutral-500' : 'text-gray-400']"
94
- >
95
- Searching...
96
- </div>
97
-
98
- <!-- Suggestions list -->
99
- <div ref="listRef">
100
- <button
101
- v-for="(agent, index) in suggestions"
102
- :key="agent.id"
103
- type="button"
104
- role="option"
105
- :aria-selected="index === activeIndex"
106
- :class="[
107
- 'flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors',
108
- index === activeIndex
109
- ? escDark
110
- ? 'bg-white/[0.06] text-white'
111
- : 'bg-blue-50 text-blue-900'
112
- : escDark
113
- ? 'text-neutral-300 hover:bg-white/[0.04]'
114
- : 'text-gray-700 hover:bg-gray-50',
115
- ]"
116
- @click="selectAgent(agent)"
117
- @mouseenter="activeIndex = index"
118
- >
119
- <!-- Avatar placeholder -->
120
- <div
121
- :class="[
122
- 'flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-full text-xs font-semibold',
123
- escDark ? 'bg-cyan-500/20 text-cyan-400' : 'bg-blue-100 text-blue-700',
124
- ]"
125
- >
126
- {{
127
- (agent.name || '')
128
- .split(' ')
129
- .map((w) => w[0])
130
- .join('')
131
- .toUpperCase()
132
- .slice(0, 2)
133
- }}
134
- </div>
135
- <div class="min-w-0 flex-1">
136
- <div :class="['truncate font-medium text-sm', escDark ? 'text-white' : 'text-gray-900']">
137
- {{ agent.name }}
138
- </div>
139
- <div :class="['truncate text-xs', escDark ? 'text-neutral-500' : 'text-gray-500']">
140
- {{ agent.email }}
141
- </div>
142
- </div>
143
- </button>
144
- </div>
145
-
146
- <!-- No results -->
147
- <div
148
- v-if="!loading && suggestions.length === 0 && visible"
149
- :class="['px-3 py-2 text-xs', escDark ? 'text-neutral-500' : 'text-gray-400']"
150
- >
151
- No agents found
152
- </div>
153
- </div>
154
- </template>
1
+ <script setup>
2
+ import { ref, computed, inject, watch, nextTick } from 'vue';
3
+
4
+ const props = defineProps({
5
+ suggestions: { type: Array, default: () => [] },
6
+ visible: { type: Boolean, default: false },
7
+ loading: { type: Boolean, default: false },
8
+ });
9
+
10
+ const emit = defineEmits(['select', 'close']);
11
+
12
+ const escDark = inject(
13
+ 'esc-dark',
14
+ computed(() => false),
15
+ );
16
+
17
+ const activeIndex = ref(0);
18
+ const listRef = ref(null);
19
+
20
+ // Reset active index when suggestions change
21
+ watch(
22
+ () => props.suggestions,
23
+ () => {
24
+ activeIndex.value = 0;
25
+ },
26
+ );
27
+
28
+ function scrollActiveIntoView() {
29
+ nextTick(() => {
30
+ const list = listRef.value;
31
+ if (!list) return;
32
+ const item = list.children[activeIndex.value];
33
+ if (item) {
34
+ item.scrollIntoView({ block: 'nearest' });
35
+ }
36
+ });
37
+ }
38
+
39
+ function onKeydown(e) {
40
+ if (!props.visible) return false;
41
+
42
+ if (e.key === 'ArrowDown') {
43
+ e.preventDefault();
44
+ activeIndex.value = (activeIndex.value + 1) % props.suggestions.length;
45
+ scrollActiveIntoView();
46
+ return true;
47
+ }
48
+
49
+ if (e.key === 'ArrowUp') {
50
+ e.preventDefault();
51
+ activeIndex.value = (activeIndex.value - 1 + props.suggestions.length) % props.suggestions.length;
52
+ scrollActiveIntoView();
53
+ return true;
54
+ }
55
+
56
+ if (e.key === 'Enter' || e.key === 'Tab') {
57
+ if (props.suggestions.length > 0) {
58
+ e.preventDefault();
59
+ emit('select', props.suggestions[activeIndex.value]);
60
+ return true;
61
+ }
62
+ }
63
+
64
+ if (e.key === 'Escape') {
65
+ e.preventDefault();
66
+ emit('close');
67
+ return true;
68
+ }
69
+
70
+ return false;
71
+ }
72
+
73
+ function selectAgent(agent) {
74
+ emit('select', agent);
75
+ }
76
+
77
+ defineExpose({ onKeydown });
78
+ </script>
79
+
80
+ <template>
81
+ <div
82
+ v-if="visible && (suggestions.length > 0 || loading)"
83
+ :class="[
84
+ 'absolute z-50 w-64 max-h-48 overflow-y-auto rounded-lg border shadow-lg',
85
+ escDark ? 'border-white/10 bg-neutral-900 shadow-black/40' : 'border-gray-200 bg-white shadow-gray-200/50',
86
+ ]"
87
+ role="listbox"
88
+ aria-label="Agent suggestions"
89
+ >
90
+ <!-- Loading state -->
91
+ <div
92
+ v-if="loading && suggestions.length === 0"
93
+ :class="['px-3 py-2 text-xs', escDark ? 'text-neutral-500' : 'text-gray-400']"
94
+ >
95
+ Searching...
96
+ </div>
97
+
98
+ <!-- Suggestions list -->
99
+ <div ref="listRef">
100
+ <button
101
+ v-for="(agent, index) in suggestions"
102
+ :key="agent.id"
103
+ type="button"
104
+ role="option"
105
+ :aria-selected="index === activeIndex"
106
+ :class="[
107
+ 'flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors',
108
+ index === activeIndex
109
+ ? escDark
110
+ ? 'bg-white/[0.06] text-white'
111
+ : 'bg-blue-50 text-blue-900'
112
+ : escDark
113
+ ? 'text-neutral-300 hover:bg-white/[0.04]'
114
+ : 'text-gray-700 hover:bg-gray-50',
115
+ ]"
116
+ @click="selectAgent(agent)"
117
+ @mouseenter="activeIndex = index"
118
+ >
119
+ <!-- Avatar placeholder -->
120
+ <div
121
+ :class="[
122
+ 'flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-full text-xs font-semibold',
123
+ escDark ? 'bg-cyan-500/20 text-cyan-400' : 'bg-blue-100 text-blue-700',
124
+ ]"
125
+ >
126
+ {{
127
+ (agent.name || '')
128
+ .split(' ')
129
+ .map((w) => w[0])
130
+ .join('')
131
+ .toUpperCase()
132
+ .slice(0, 2)
133
+ }}
134
+ </div>
135
+ <div class="min-w-0 flex-1">
136
+ <div :class="['truncate font-medium text-sm', escDark ? 'text-white' : 'text-gray-900']">
137
+ {{ agent.name }}
138
+ </div>
139
+ <div :class="['truncate text-xs', escDark ? 'text-neutral-500' : 'text-gray-500']">
140
+ {{ agent.email }}
141
+ </div>
142
+ </div>
143
+ </button>
144
+ </div>
145
+
146
+ <!-- No results -->
147
+ <div
148
+ v-if="!loading && suggestions.length === 0 && visible"
149
+ :class="['px-3 py-2 text-xs', escDark ? 'text-neutral-500' : 'text-gray-400']"
150
+ >
151
+ No agents found
152
+ </div>
153
+ </div>
154
+ </template>
@@ -1,89 +1,89 @@
1
- <script setup>
2
- import { computed } from 'vue';
3
-
4
- const props = defineProps({
5
- label: { type: String, required: true },
6
- value: { type: [Number, String], required: true },
7
- previousValue: { type: [Number, String], default: null },
8
- format: { type: String, default: '' },
9
- icon: { type: String, default: null },
10
- invertColor: { type: Boolean, default: false },
11
- });
12
-
13
- const percentChange = computed(() => {
14
- if (props.previousValue === null || props.previousValue === 0) return null;
15
- const current = Number(props.value) || 0;
16
- const previous = Number(props.previousValue) || 0;
17
- if (previous === 0) return null;
18
- return Math.round(((current - previous) / previous) * 100);
19
- });
20
-
21
- const changeDirection = computed(() => {
22
- if (percentChange.value === null || percentChange.value === 0) return 'neutral';
23
- return percentChange.value > 0 ? 'up' : 'down';
24
- });
25
-
26
- const changeColor = computed(() => {
27
- if (changeDirection.value === 'neutral') return 'text-[var(--esc-panel-text-muted)]';
28
- const isPositiveGood = !props.invertColor;
29
- if (changeDirection.value === 'up') {
30
- return isPositiveGood ? 'text-emerald-400' : 'text-red-400';
31
- }
32
- return isPositiveGood ? 'text-red-400' : 'text-emerald-400';
33
- });
34
- </script>
35
-
36
- <template>
37
- <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5">
38
- <div class="flex items-start justify-between">
39
- <div>
40
- <div class="text-[13px] font-medium text-[var(--esc-panel-text-muted)]">
41
- {{ label }}
42
- </div>
43
- <div class="mt-2 text-2xl font-bold tracking-tight text-[var(--esc-panel-text)]">
44
- {{ value }}{{ format }}
45
- </div>
46
- </div>
47
- <div v-if="icon" class="flex h-10 w-10 items-center justify-center rounded-lg bg-[var(--esc-panel-hover)]">
48
- <svg
49
- class="h-5 w-5 text-[var(--esc-panel-text-muted)]"
50
- fill="none"
51
- stroke="currentColor"
52
- stroke-width="1.5"
53
- viewBox="0 0 24 24"
54
- >
55
- <path stroke-linecap="round" stroke-linejoin="round" :d="icon" />
56
- </svg>
57
- </div>
58
- </div>
59
- <div v-if="previousValue !== null" class="mt-3 flex items-center gap-2">
60
- <div class="flex items-center gap-1" :class="changeColor">
61
- <svg
62
- v-if="changeDirection === 'up'"
63
- class="h-4 w-4"
64
- fill="none"
65
- stroke="currentColor"
66
- stroke-width="2"
67
- viewBox="0 0 24 24"
68
- >
69
- <path stroke-linecap="round" stroke-linejoin="round" d="M4.5 19.5l15-15m0 0H8.25m11.25 0v11.25" />
70
- </svg>
71
- <svg
72
- v-else-if="changeDirection === 'down'"
73
- class="h-4 w-4"
74
- fill="none"
75
- stroke="currentColor"
76
- stroke-width="2"
77
- viewBox="0 0 24 24"
78
- >
79
- <path stroke-linecap="round" stroke-linejoin="round" d="M4.5 4.5l15 15m0 0V8.25m0 11.25H8.25" />
80
- </svg>
81
- <span v-else class="text-sm">--</span>
82
- <span class="text-xs font-medium">
83
- {{ percentChange !== null ? `${Math.abs(percentChange)}%` : '--' }}
84
- </span>
85
- </div>
86
- <span class="text-xs text-[var(--esc-panel-text-muted)]"> vs {{ previousValue }}{{ format }} prev </span>
87
- </div>
88
- </div>
89
- </template>
1
+ <script setup>
2
+ import { computed } from 'vue';
3
+
4
+ const props = defineProps({
5
+ label: { type: String, required: true },
6
+ value: { type: [Number, String], required: true },
7
+ previousValue: { type: [Number, String], default: null },
8
+ format: { type: String, default: '' },
9
+ icon: { type: String, default: null },
10
+ invertColor: { type: Boolean, default: false },
11
+ });
12
+
13
+ const percentChange = computed(() => {
14
+ if (props.previousValue === null || props.previousValue === 0) return null;
15
+ const current = Number(props.value) || 0;
16
+ const previous = Number(props.previousValue) || 0;
17
+ if (previous === 0) return null;
18
+ return Math.round(((current - previous) / previous) * 100);
19
+ });
20
+
21
+ const changeDirection = computed(() => {
22
+ if (percentChange.value === null || percentChange.value === 0) return 'neutral';
23
+ return percentChange.value > 0 ? 'up' : 'down';
24
+ });
25
+
26
+ const changeColor = computed(() => {
27
+ if (changeDirection.value === 'neutral') return 'text-[var(--esc-panel-text-muted)]';
28
+ const isPositiveGood = !props.invertColor;
29
+ if (changeDirection.value === 'up') {
30
+ return isPositiveGood ? 'text-emerald-400' : 'text-red-400';
31
+ }
32
+ return isPositiveGood ? 'text-red-400' : 'text-emerald-400';
33
+ });
34
+ </script>
35
+
36
+ <template>
37
+ <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5">
38
+ <div class="flex items-start justify-between">
39
+ <div>
40
+ <div class="text-[13px] font-medium text-[var(--esc-panel-text-muted)]">
41
+ {{ label }}
42
+ </div>
43
+ <div class="mt-2 text-2xl font-bold tracking-tight text-[var(--esc-panel-text)]">
44
+ {{ value }}{{ format }}
45
+ </div>
46
+ </div>
47
+ <div v-if="icon" class="flex h-10 w-10 items-center justify-center rounded-lg bg-[var(--esc-panel-hover)]">
48
+ <svg
49
+ class="h-5 w-5 text-[var(--esc-panel-text-muted)]"
50
+ fill="none"
51
+ stroke="currentColor"
52
+ stroke-width="1.5"
53
+ viewBox="0 0 24 24"
54
+ >
55
+ <path stroke-linecap="round" stroke-linejoin="round" :d="icon" />
56
+ </svg>
57
+ </div>
58
+ </div>
59
+ <div v-if="previousValue !== null" class="mt-3 flex items-center gap-2">
60
+ <div class="flex items-center gap-1" :class="changeColor">
61
+ <svg
62
+ v-if="changeDirection === 'up'"
63
+ class="h-4 w-4"
64
+ fill="none"
65
+ stroke="currentColor"
66
+ stroke-width="2"
67
+ viewBox="0 0 24 24"
68
+ >
69
+ <path stroke-linecap="round" stroke-linejoin="round" d="M4.5 19.5l15-15m0 0H8.25m11.25 0v11.25" />
70
+ </svg>
71
+ <svg
72
+ v-else-if="changeDirection === 'down'"
73
+ class="h-4 w-4"
74
+ fill="none"
75
+ stroke="currentColor"
76
+ stroke-width="2"
77
+ viewBox="0 0 24 24"
78
+ >
79
+ <path stroke-linecap="round" stroke-linejoin="round" d="M4.5 4.5l15 15m0 0V8.25m0 11.25H8.25" />
80
+ </svg>
81
+ <span v-else class="text-sm">--</span>
82
+ <span class="text-xs font-medium">
83
+ {{ percentChange !== null ? `${Math.abs(percentChange)}%` : '--' }}
84
+ </span>
85
+ </div>
86
+ <span class="text-xs text-[var(--esc-panel-text-muted)]"> vs {{ previousValue }}{{ format }} prev </span>
87
+ </div>
88
+ </div>
89
+ </template>
@@ -1,67 +1,67 @@
1
- <script setup>
2
- import { computed } from 'vue';
3
-
4
- const props = defineProps({
5
- title: { type: String, default: 'Percentile Distribution' },
6
- percentiles: {
7
- type: Object,
8
- default: () => ({ p50: 0, p75: 0, p90: 0, p95: 0, p99: 0 }),
9
- },
10
- unit: { type: String, default: 'h' },
11
- target: { type: Number, default: null },
12
- });
13
-
14
- const maxVal = computed(() => {
15
- const vals = Object.values(props.percentiles);
16
- return Math.max(...vals, 1);
17
- });
18
-
19
- const bars = computed(() => {
20
- const entries = [
21
- { key: 'p50', label: 'P50 (Median)', color: '#10b981' },
22
- { key: 'p75', label: 'P75', color: '#f59e0b' },
23
- { key: 'p90', label: 'P90', color: '#f97316' },
24
- { key: 'p95', label: 'P95', color: '#ef4444' },
25
- { key: 'p99', label: 'P99', color: '#dc2626' },
26
- ];
27
- return entries.map((e) => ({
28
- ...e,
29
- value: props.percentiles[e.key] || 0,
30
- width: ((props.percentiles[e.key] || 0) / maxVal.value) * 100,
31
- }));
32
- });
33
- </script>
34
-
35
- <template>
36
- <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5">
37
- <h3 v-if="title" class="mb-4 text-sm font-semibold text-[var(--esc-panel-text-secondary)]">{{ title }}</h3>
38
- <div class="space-y-3">
39
- <div v-for="bar in bars" :key="bar.key" class="flex items-center gap-3">
40
- <span class="w-24 shrink-0 text-xs font-medium text-[var(--esc-panel-text-muted)]">
41
- {{ bar.label }}
42
- </span>
43
- <div class="relative flex-1">
44
- <div class="h-6 overflow-hidden rounded-full bg-[var(--esc-panel-hover)]">
45
- <div
46
- class="h-full rounded-full transition-all duration-700 ease-out"
47
- :style="{ width: `${bar.width}%`, backgroundColor: bar.color }"
48
- ></div>
49
- </div>
50
- <div
51
- v-if="target !== null"
52
- class="absolute top-0 h-6 w-0.5 bg-white/40"
53
- :style="{ left: `${(target / maxVal) * 100}%` }"
54
- :title="`Target: ${target}${unit}`"
55
- ></div>
56
- </div>
57
- <span class="w-16 text-right text-xs font-bold text-[var(--esc-panel-text)]">
58
- {{ bar.value }}{{ unit }}
59
- </span>
60
- </div>
61
- </div>
62
- <div v-if="target !== null" class="mt-3 flex items-center gap-2 text-xs text-[var(--esc-panel-text-muted)]">
63
- <span class="inline-block h-3 w-0.5 bg-white/40"></span>
64
- Target: {{ target }}{{ unit }}
65
- </div>
66
- </div>
67
- </template>
1
+ <script setup>
2
+ import { computed } from 'vue';
3
+
4
+ const props = defineProps({
5
+ title: { type: String, default: 'Percentile Distribution' },
6
+ percentiles: {
7
+ type: Object,
8
+ default: () => ({ p50: 0, p75: 0, p90: 0, p95: 0, p99: 0 }),
9
+ },
10
+ unit: { type: String, default: 'h' },
11
+ target: { type: Number, default: null },
12
+ });
13
+
14
+ const maxVal = computed(() => {
15
+ const vals = Object.values(props.percentiles);
16
+ return Math.max(...vals, 1);
17
+ });
18
+
19
+ const bars = computed(() => {
20
+ const entries = [
21
+ { key: 'p50', label: 'P50 (Median)', color: '#10b981' },
22
+ { key: 'p75', label: 'P75', color: '#f59e0b' },
23
+ { key: 'p90', label: 'P90', color: '#f97316' },
24
+ { key: 'p95', label: 'P95', color: '#ef4444' },
25
+ { key: 'p99', label: 'P99', color: '#dc2626' },
26
+ ];
27
+ return entries.map((e) => ({
28
+ ...e,
29
+ value: props.percentiles[e.key] || 0,
30
+ width: ((props.percentiles[e.key] || 0) / maxVal.value) * 100,
31
+ }));
32
+ });
33
+ </script>
34
+
35
+ <template>
36
+ <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5">
37
+ <h3 v-if="title" class="mb-4 text-sm font-semibold text-[var(--esc-panel-text-secondary)]">{{ title }}</h3>
38
+ <div class="space-y-3">
39
+ <div v-for="bar in bars" :key="bar.key" class="flex items-center gap-3">
40
+ <span class="w-24 shrink-0 text-xs font-medium text-[var(--esc-panel-text-muted)]">
41
+ {{ bar.label }}
42
+ </span>
43
+ <div class="relative flex-1">
44
+ <div class="h-6 overflow-hidden rounded-full bg-[var(--esc-panel-hover)]">
45
+ <div
46
+ class="h-full rounded-full transition-all duration-700 ease-out"
47
+ :style="{ width: `${bar.width}%`, backgroundColor: bar.color }"
48
+ ></div>
49
+ </div>
50
+ <div
51
+ v-if="target !== null"
52
+ class="absolute top-0 h-6 w-0.5 bg-white/40"
53
+ :style="{ left: `${(target / maxVal) * 100}%` }"
54
+ :title="`Target: ${target}${unit}`"
55
+ ></div>
56
+ </div>
57
+ <span class="w-16 text-right text-xs font-bold text-[var(--esc-panel-text)]">
58
+ {{ bar.value }}{{ unit }}
59
+ </span>
60
+ </div>
61
+ </div>
62
+ <div v-if="target !== null" class="mt-3 flex items-center gap-2 text-xs text-[var(--esc-panel-text-muted)]">
63
+ <span class="inline-block h-3 w-0.5 bg-white/40"></span>
64
+ Target: {{ target }}{{ unit }}
65
+ </div>
66
+ </div>
67
+ </template>