@mongoosejs/studio 0.2.12 → 0.3.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.
- package/backend/actions/ChatMessage/executeScript.js +5 -1
- package/backend/actions/ChatThread/createChatMessage.js +2 -1
- package/backend/actions/ChatThread/streamChatMessage.js +2 -2
- package/backend/actions/Model/getEstimatedDocumentCounts.js +38 -0
- package/backend/actions/Model/index.js +1 -0
- package/backend/actions/Model/streamDocumentChanges.js +8 -7
- package/backend/actions/Task/getTasks.js +9 -6
- package/backend/authorize.js +1 -0
- package/backend/index.js +11 -3
- package/eslint.config.js +5 -1
- package/express.js +1 -0
- package/frontend/public/app.js +25235 -662
- package/frontend/public/dark-theme.css +365 -0
- package/frontend/public/images/mongoose-studio.svg +4 -0
- package/frontend/public/index.html +21 -1
- package/frontend/public/style.css +5 -7
- package/frontend/public/theme-variables.css +294 -0
- package/frontend/public/tw.css +461 -239
- package/frontend/src/ace-editor/ace-editor.html +4 -0
- package/frontend/src/ace-editor/ace-editor.js +89 -0
- package/frontend/src/aceEditor.js +69 -0
- package/frontend/src/api.js +6 -0
- package/frontend/src/chat/chat-message/chat-message.html +1 -1
- package/frontend/src/chat/chat-message/chat-message.js +1 -1
- package/frontend/src/chat/chat-message-script/chat-message-script.html +51 -34
- package/frontend/src/chat/chat-message-script/chat-message-script.js +12 -55
- package/frontend/src/chat/chat.html +72 -37
- package/frontend/src/chat/chat.js +26 -2
- package/frontend/src/clone-document/clone-document.html +7 -2
- package/frontend/src/clone-document/clone-document.js +1 -8
- package/frontend/src/create-dashboard/create-dashboard.html +11 -6
- package/frontend/src/create-dashboard/create-dashboard.js +0 -7
- package/frontend/src/create-document/create-document.html +15 -9
- package/frontend/src/create-document/create-document.js +5 -12
- package/frontend/src/dashboard/dashboard.html +14 -12
- package/frontend/src/dashboard/dashboard.js +12 -4
- package/frontend/src/dashboard/edit-dashboard/edit-dashboard.html +13 -7
- package/frontend/src/dashboard/edit-dashboard/edit-dashboard.js +13 -21
- package/frontend/src/dashboard-result/dashboard-chart/dashboard-chart.html +19 -17
- package/frontend/src/dashboard-result/dashboard-chart/dashboard-chart.js +97 -2
- package/frontend/src/dashboard-result/dashboard-map/dashboard-map.js +27 -3
- package/frontend/src/dashboard-result/dashboard-result.html +3 -3
- package/frontend/src/dashboards/dashboards.html +101 -109
- package/frontend/src/dashboards/dashboards.js +25 -1
- package/frontend/src/detail-default/detail-default.html +2 -2
- package/frontend/src/detail-default/detail-default.js +24 -3
- package/frontend/src/document/confirm-changes/confirm-changes.html +1 -1
- package/frontend/src/document/confirm-delete/confirm-delete.html +1 -1
- package/frontend/src/document/document.css +1 -1
- package/frontend/src/document/document.html +53 -27
- package/frontend/src/document/document.js +27 -1
- package/frontend/src/document/execute-script/execute-script.html +20 -21
- package/frontend/src/document/execute-script/execute-script.js +1 -43
- package/frontend/src/document-details/document-details.css +4 -9
- package/frontend/src/document-details/document-details.html +34 -33
- package/frontend/src/document-details/document-details.js +2 -53
- package/frontend/src/document-details/document-property/document-property.html +12 -12
- package/frontend/src/edit-array/edit-array.html +7 -6
- package/frontend/src/edit-array/edit-array.js +10 -50
- package/frontend/src/edit-boolean/edit-boolean.html +12 -12
- package/frontend/src/edit-date/edit-date.html +2 -2
- package/frontend/src/edit-default/edit-default.html +1 -1
- package/frontend/src/edit-string/edit-string.html +3 -3
- package/frontend/src/edit-subdocument/edit-subdocument.html +5 -3
- package/frontend/src/edit-subdocument/edit-subdocument.js +1 -15
- package/frontend/src/export-query-results/export-query-results.html +3 -3
- package/frontend/src/json-node/json-node.html +3 -3
- package/frontend/src/list-json/json-node.html +1 -1
- package/frontend/src/models/document-search/document-search.html +3 -3
- package/frontend/src/models/model-switcher/model-switcher.html +53 -0
- package/frontend/src/models/model-switcher/model-switcher.js +123 -0
- package/frontend/src/models/models.css +3 -10
- package/frontend/src/models/models.html +146 -74
- package/frontend/src/models/models.js +142 -4
- package/frontend/src/navbar/navbar.html +157 -97
- package/frontend/src/navbar/navbar.js +32 -13
- package/frontend/src/routes.js +20 -4
- package/frontend/src/splash/splash.html +5 -5
- package/frontend/src/task-by-name/task-by-name.html +15 -0
- package/frontend/src/task-by-name/task-by-name.js +78 -0
- package/frontend/src/task-single/task-single.html +157 -0
- package/frontend/src/task-single/task-single.js +116 -0
- package/frontend/src/tasks/task-details/task-details.html +124 -73
- package/frontend/src/tasks/task-details/task-details.js +166 -10
- package/frontend/src/tasks/tasks.html +37 -48
- package/frontend/src/tasks/tasks.js +11 -50
- package/frontend/src/team/new-invitation/new-invitation.html +8 -8
- package/frontend/src/team/team.html +27 -27
- package/frontend/src/update-document/update-document.html +7 -2
- package/frontend/src/update-document/update-document.js +2 -11
- package/package.json +3 -1
- package/tailwind.config.js +75 -11
|
@@ -13,6 +13,8 @@ appendCSS(require('./models.css'));
|
|
|
13
13
|
const limit = 20;
|
|
14
14
|
const OUTPUT_TYPE_STORAGE_KEY = 'studio:model-output-type';
|
|
15
15
|
const SELECTED_GEO_FIELD_STORAGE_KEY = 'studio:model-selected-geo-field';
|
|
16
|
+
const RECENTLY_VIEWED_MODELS_KEY = 'studio:recently-viewed-models';
|
|
17
|
+
const MAX_RECENT_MODELS = 4;
|
|
16
18
|
|
|
17
19
|
module.exports = app => app.component('models', {
|
|
18
20
|
template: template,
|
|
@@ -20,6 +22,7 @@ module.exports = app => app.component('models', {
|
|
|
20
22
|
data: () => ({
|
|
21
23
|
models: [],
|
|
22
24
|
currentModel: null,
|
|
25
|
+
modelDocumentCounts: {},
|
|
23
26
|
documents: [],
|
|
24
27
|
schemaPaths: [],
|
|
25
28
|
filteredPaths: [],
|
|
@@ -50,21 +53,28 @@ module.exports = app => app.component('models', {
|
|
|
50
53
|
selectedGeoField: null,
|
|
51
54
|
mapInstance: null,
|
|
52
55
|
mapLayer: null,
|
|
56
|
+
mapTileLayer: null,
|
|
53
57
|
hideSidebar: null,
|
|
54
58
|
lastSelectedIndex: null,
|
|
55
59
|
error: null,
|
|
56
60
|
showActionsMenu: false,
|
|
57
|
-
collectionInfo: null
|
|
61
|
+
collectionInfo: null,
|
|
62
|
+
modelSearch: '',
|
|
63
|
+
recentlyViewedModels: [],
|
|
64
|
+
showModelSwitcher: false
|
|
58
65
|
}),
|
|
59
66
|
created() {
|
|
60
67
|
this.currentModel = this.model;
|
|
61
68
|
this.loadOutputPreference();
|
|
62
69
|
this.loadSelectedGeoField();
|
|
70
|
+
this.loadRecentlyViewedModels();
|
|
63
71
|
},
|
|
64
72
|
beforeDestroy() {
|
|
65
73
|
document.removeEventListener('scroll', this.onScroll, true);
|
|
66
74
|
window.removeEventListener('popstate', this.onPopState, true);
|
|
67
75
|
document.removeEventListener('click', this.onOutsideActionsMenuClick, true);
|
|
76
|
+
document.documentElement.removeEventListener('studio-theme-changed', this.onStudioThemeChanged);
|
|
77
|
+
document.removeEventListener('keydown', this.onCtrlP, true);
|
|
68
78
|
this.destroyMap();
|
|
69
79
|
},
|
|
70
80
|
async mounted() {
|
|
@@ -82,8 +92,18 @@ module.exports = app => app.component('models', {
|
|
|
82
92
|
}
|
|
83
93
|
};
|
|
84
94
|
document.addEventListener('click', this.onOutsideActionsMenuClick, true);
|
|
95
|
+
this.onStudioThemeChanged = () => this.updateMapTileLayer();
|
|
96
|
+
document.documentElement.addEventListener('studio-theme-changed', this.onStudioThemeChanged);
|
|
97
|
+
this.onCtrlP = (event) => {
|
|
98
|
+
if ((event.ctrlKey || event.metaKey) && event.key === 'p') {
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
this.openModelSwitcher();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
document.addEventListener('keydown', this.onCtrlP, true);
|
|
85
104
|
const { models, readyState } = await api.Model.listModels();
|
|
86
105
|
this.models = models;
|
|
106
|
+
await this.loadModelCounts();
|
|
87
107
|
if (this.currentModel == null && this.models.length > 0) {
|
|
88
108
|
this.currentModel = this.models[0];
|
|
89
109
|
}
|
|
@@ -138,6 +158,21 @@ module.exports = app => app.component('models', {
|
|
|
138
158
|
}
|
|
139
159
|
return map;
|
|
140
160
|
},
|
|
161
|
+
filteredModels() {
|
|
162
|
+
if (!this.modelSearch.trim()) {
|
|
163
|
+
return this.models;
|
|
164
|
+
}
|
|
165
|
+
const search = this.modelSearch.trim().toLowerCase();
|
|
166
|
+
return this.models.filter(m => m.toLowerCase().includes(search));
|
|
167
|
+
},
|
|
168
|
+
filteredRecentModels() {
|
|
169
|
+
const recent = this.recentlyViewedModels.filter(m => this.models.includes(m));
|
|
170
|
+
if (!this.modelSearch.trim()) {
|
|
171
|
+
return recent;
|
|
172
|
+
}
|
|
173
|
+
const search = this.modelSearch.trim().toLowerCase();
|
|
174
|
+
return recent.filter(m => m.toLowerCase().includes(search));
|
|
175
|
+
},
|
|
141
176
|
geoJsonFields() {
|
|
142
177
|
// Find schema paths that look like GeoJSON fields
|
|
143
178
|
// GeoJSON fields have nested 'type' and 'coordinates' properties
|
|
@@ -190,6 +225,49 @@ module.exports = app => app.component('models', {
|
|
|
190
225
|
}
|
|
191
226
|
},
|
|
192
227
|
methods: {
|
|
228
|
+
highlightMatch(model) {
|
|
229
|
+
const search = this.modelSearch.trim();
|
|
230
|
+
if (!search) {
|
|
231
|
+
return model;
|
|
232
|
+
}
|
|
233
|
+
const idx = model.toLowerCase().indexOf(search.toLowerCase());
|
|
234
|
+
if (idx === -1) {
|
|
235
|
+
return model;
|
|
236
|
+
}
|
|
237
|
+
const before = model.slice(0, idx);
|
|
238
|
+
const match = model.slice(idx, idx + search.length);
|
|
239
|
+
const after = model.slice(idx + search.length);
|
|
240
|
+
return `${xss(before)}<strong>${xss(match)}</strong>${xss(after)}`;
|
|
241
|
+
},
|
|
242
|
+
loadRecentlyViewedModels() {
|
|
243
|
+
if (typeof window === 'undefined' || !window.localStorage) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
try {
|
|
247
|
+
const stored = window.localStorage.getItem(RECENTLY_VIEWED_MODELS_KEY);
|
|
248
|
+
if (stored) {
|
|
249
|
+
const parsed = JSON.parse(stored);
|
|
250
|
+
if (Array.isArray(parsed)) {
|
|
251
|
+
this.recentlyViewedModels = parsed.map(item => String(item)).slice(0, MAX_RECENT_MODELS);
|
|
252
|
+
} else {
|
|
253
|
+
this.recentlyViewedModels = [];
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
} catch (err) {
|
|
257
|
+
this.recentlyViewedModels = [];
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
trackRecentModel(model) {
|
|
261
|
+
if (!model) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
const filtered = this.recentlyViewedModels.filter(m => m !== model);
|
|
265
|
+
filtered.unshift(model);
|
|
266
|
+
this.recentlyViewedModels = filtered.slice(0, MAX_RECENT_MODELS);
|
|
267
|
+
if (typeof window !== 'undefined' && window.localStorage) {
|
|
268
|
+
window.localStorage.setItem(RECENTLY_VIEWED_MODELS_KEY, JSON.stringify(this.recentlyViewedModels));
|
|
269
|
+
}
|
|
270
|
+
},
|
|
193
271
|
loadOutputPreference() {
|
|
194
272
|
if (typeof window === 'undefined' || !window.localStorage) {
|
|
195
273
|
return;
|
|
@@ -263,9 +341,7 @@ module.exports = app => app.component('models', {
|
|
|
263
341
|
mapElement.style.setProperty('width', '100%', 'important');
|
|
264
342
|
|
|
265
343
|
this.mapInstance = L.map(this.$refs.modelsMap).setView([0, 0], 2);
|
|
266
|
-
|
|
267
|
-
attribution: '© OpenStreetMap contributors'
|
|
268
|
-
}).addTo(this.mapInstance);
|
|
344
|
+
this.updateMapTileLayer();
|
|
269
345
|
|
|
270
346
|
this.$nextTick(() => {
|
|
271
347
|
if (this.mapInstance) {
|
|
@@ -274,11 +350,30 @@ module.exports = app => app.component('models', {
|
|
|
274
350
|
}
|
|
275
351
|
});
|
|
276
352
|
},
|
|
353
|
+
getMapTileLayerOptions() {
|
|
354
|
+
const isDark = typeof document !== 'undefined' && document.documentElement.classList.contains('dark');
|
|
355
|
+
return isDark
|
|
356
|
+
? { url: 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png', attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors © <a href="https://carto.com/attributions">CARTO</a>', subdomains: 'abcd', maxZoom: 20 }
|
|
357
|
+
: { url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', attribution: '© OpenStreetMap contributors' };
|
|
358
|
+
},
|
|
359
|
+
updateMapTileLayer() {
|
|
360
|
+
if (!this.mapInstance || typeof L === 'undefined') return;
|
|
361
|
+
if (this.mapTileLayer) {
|
|
362
|
+
this.mapTileLayer.remove();
|
|
363
|
+
this.mapTileLayer = null;
|
|
364
|
+
}
|
|
365
|
+
const opts = this.getMapTileLayerOptions();
|
|
366
|
+
this.mapTileLayer = L.tileLayer(opts.url, opts).addTo(this.mapInstance);
|
|
367
|
+
},
|
|
277
368
|
destroyMap() {
|
|
278
369
|
if (this.mapLayer) {
|
|
279
370
|
this.mapLayer.remove();
|
|
280
371
|
this.mapLayer = null;
|
|
281
372
|
}
|
|
373
|
+
if (this.mapTileLayer) {
|
|
374
|
+
this.mapTileLayer.remove();
|
|
375
|
+
this.mapTileLayer = null;
|
|
376
|
+
}
|
|
282
377
|
if (this.mapInstance) {
|
|
283
378
|
this.mapInstance.remove();
|
|
284
379
|
this.mapInstance = null;
|
|
@@ -589,6 +684,25 @@ module.exports = app => app.component('models', {
|
|
|
589
684
|
|
|
590
685
|
return value.toLocaleString();
|
|
591
686
|
},
|
|
687
|
+
formatCompactCount(value) {
|
|
688
|
+
if (typeof value !== 'number') {
|
|
689
|
+
return '—';
|
|
690
|
+
}
|
|
691
|
+
if (value < 1000) {
|
|
692
|
+
return `${value}`;
|
|
693
|
+
}
|
|
694
|
+
const formatValue = (number, suffix) => {
|
|
695
|
+
const rounded = (Math.round(number * 10) / 10).toFixed(1).replace(/\.0$/, '');
|
|
696
|
+
return `${rounded}${suffix}`;
|
|
697
|
+
};
|
|
698
|
+
if (value < 1000000) {
|
|
699
|
+
return formatValue(value / 1000, 'k');
|
|
700
|
+
}
|
|
701
|
+
if (value < 1000000000) {
|
|
702
|
+
return formatValue(value / 1000000, 'M');
|
|
703
|
+
}
|
|
704
|
+
return formatValue(value / 1000000000, 'B');
|
|
705
|
+
},
|
|
592
706
|
checkIndexLocation(indexName) {
|
|
593
707
|
if (this.schemaIndexes.find(x => x.name == indexName) && this.mongoDBIndexes.find(x => x.name == indexName)) {
|
|
594
708
|
return 'text-gray-500';
|
|
@@ -599,6 +713,9 @@ module.exports = app => app.component('models', {
|
|
|
599
713
|
}
|
|
600
714
|
},
|
|
601
715
|
async getDocuments() {
|
|
716
|
+
// Track recently viewed model
|
|
717
|
+
this.trackRecentModel(this.currentModel);
|
|
718
|
+
|
|
602
719
|
// Clear previous data
|
|
603
720
|
this.documents = [];
|
|
604
721
|
this.schemaPaths = [];
|
|
@@ -842,6 +959,27 @@ module.exports = app => app.component('models', {
|
|
|
842
959
|
} else {
|
|
843
960
|
this.selectMultiple = true;
|
|
844
961
|
}
|
|
962
|
+
},
|
|
963
|
+
openModelSwitcher() {
|
|
964
|
+
this.showModelSwitcher = true;
|
|
965
|
+
},
|
|
966
|
+
selectSwitcherModel(model) {
|
|
967
|
+
this.showModelSwitcher = false;
|
|
968
|
+
this.trackRecentModel(model);
|
|
969
|
+
this.$router.push('/model/' + model);
|
|
970
|
+
},
|
|
971
|
+
async loadModelCounts() {
|
|
972
|
+
if (!Array.isArray(this.models) || this.models.length === 0) {
|
|
973
|
+
return;
|
|
974
|
+
}
|
|
975
|
+
try {
|
|
976
|
+
const { counts } = await api.Model.getEstimatedDocumentCounts();
|
|
977
|
+
if (counts && typeof counts === 'object') {
|
|
978
|
+
this.modelDocumentCounts = counts;
|
|
979
|
+
}
|
|
980
|
+
} catch (err) {
|
|
981
|
+
console.error('Failed to load model document counts', err);
|
|
982
|
+
}
|
|
845
983
|
}
|
|
846
984
|
}
|
|
847
985
|
});
|
|
@@ -1,12 +1,67 @@
|
|
|
1
|
-
<div class="navbar w-full bg-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<div class="navbar w-full bg-page border-b border-edge !h-[55px] hidden md:grid grid-cols-[1fr_auto_1fr] items-stretch px-4">
|
|
2
|
+
<!-- Left: Logo + Brand -->
|
|
3
|
+
<div class="flex items-center gap-2 self-center">
|
|
4
|
+
<router-link class="flex items-center gap-2" :to="{ name: defaultRoute }">
|
|
5
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-10 text-primary" viewBox="0 0 250 250" fill="currentColor" aria-label="Mongoose Studio Logo">
|
|
6
|
+
<path d="M 241.66,125.01 C 237.81,112.98 227.41,111.95 216.76,110.36 C 215.12,95.83 210.99,83.09 202.29,70.33 C 202.99,68.37 201.92,66.65 200.74,65.11 C 183.14,41.46 157.52,27 124.66,27 C 92.62,27 66.09,40.77 48.28,63.38 C 46.21,65.85 46.26,67.71 47.12,69.36 C 37.81,81.15 33.21,93.78 30.99,109.86 C 20.19,110.58 11.71,115.92 9.04,124.94 C 3.28,145.66 5.62,157.95 10.01,169.16 C 16.14,184.65 29.12,186.31 36.04,185.81 C 42.48,185.68 44.94,184.31 44.72,182.11 C 44.26,177.79 41.01,165.31 41.01,149.12 C 41.01,138.22 43.19,127.74 46.21,117.7 C 47.51,113.33 44.66,112.05 39.16,110.28 C 41.01,96.88 45.88,84.85 52.61,73.79 C 55.17,75.56 58.07,74.88 59.61,72.71 C 75.86,54.31 97.89,45.16 124.61,45.16 C 149.71,45.16 171.91,55.91 189.29,73.47 C 191.95,76.59 193.91,76.67 197.6,74.42 C 204.93,86.26 208.28,98.24 208.98,110.39 C 203.84,111.81 201.28,113.19 202.92,118.61 C 206.51,128.99 207.92,137.93 207.92,148.73 C 207.92,162.11 204.8,174.71 202.84,182.71 C 201.92,186.23 204.31,186.91 210.79,186.99 H 213.91 C 225.87,186.61 235.39,180.64 239.49,169.05 C 244.83,155.26 245.08,138.01 241.66,125.01 Z"/>
|
|
7
|
+
<path d="M 124.71,70.81 C 79.63,70.81 47.49,107.12 47.49,148.72 C 47.49,169.16 56.41,188.19 73.71,200.61 L 73.96,200.77 C 77.43,177.81 84.16,162.21 95.29,145.42 C 92.04,137.09 91.71,130.87 92.62,120.83 C 93.81,111.23 96.08,107.12 102.19,107.68 C 110.04,108.87 117.98,116.18 126.22,124.96 C 139.89,124.05 157.81,131.25 178.33,139.09 C 183.11,140.86 183.72,142.63 182.97,148.33 C 179.45,160.93 170.86,166.63 158.11,174.05 C 143.09,183.07 141.13,199.42 153.88,220.09 L 153.96,221.01 L 154.71,221.17 C 181.31,208.43 201.34,181.01 201.34,148.72 C 201.34,108.15 169.29,70.81 124.71,70.81 Z"/>
|
|
8
|
+
</svg>
|
|
9
|
+
<span class="text-base font-semibold text-content whitespace-nowrap">Mongoose Studio</span>
|
|
5
10
|
</router-link>
|
|
11
|
+
</div>
|
|
12
|
+
<!-- Center: Nav Links -->
|
|
13
|
+
<nav class="flex items-stretch gap-6">
|
|
14
|
+
<a v-if="hasAccess(roles, 'root')"
|
|
15
|
+
href="#/"
|
|
16
|
+
class="inline-flex items-center px-1 border-b-2 text-sm font-medium"
|
|
17
|
+
:class="documentView ? 'text-content border-primary' : 'border-transparent text-content-tertiary hover:text-content'">Documents</a>
|
|
18
|
+
<span v-else class="inline-flex items-center px-1 border-b-2 border-transparent text-sm font-medium text-gray-300 cursor-not-allowed" aria-disabled="true">
|
|
19
|
+
Documents
|
|
20
|
+
<svg class="h-4 w-4 ml-1" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
21
|
+
<path fill-rule="evenodd" d="M10 2a4 4 0 00-4 4v2H5a2 2 0 00-2 2v6a2 2 0 002 2h10a2 2 0 002-2v-6a2 2 0 00-2-2h-1V6a4 4 0 00-4-4zm-3 6V6a3 3 0 116 0v2H7z" clip-rule="evenodd" />
|
|
22
|
+
</svg>
|
|
23
|
+
</span>
|
|
24
|
+
<a v-if="hasAccess(roles, 'dashboards')"
|
|
25
|
+
href="#/dashboards"
|
|
26
|
+
class="inline-flex items-center px-1 border-b-2 text-sm font-medium"
|
|
27
|
+
:class="dashboardView ? 'text-content border-primary' : 'border-transparent text-content-tertiary hover:text-content'">Dashboards</a>
|
|
28
|
+
<span v-else class="inline-flex items-center px-1 border-b-2 border-transparent text-sm font-medium text-gray-300 cursor-not-allowed">
|
|
29
|
+
Dashboards
|
|
30
|
+
<svg class="h-4 w-4 ml-1" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
31
|
+
<path fill-rule="evenodd" d="M10 2a4 4 0 00-4 4v2H5a2 2 0 00-2 2v6a2 2 0 002 2h10a2 2 0 002-2v-6a2 2 0 00-2-2h-1V6a4 4 0 00-4-4zm-3 6V6a3 3 0 116 0v2H7z" clip-rule="evenodd" />
|
|
32
|
+
</svg>
|
|
33
|
+
</span>
|
|
34
|
+
<a v-if="hasAccess(roles, 'chat')"
|
|
35
|
+
href="#/chat"
|
|
36
|
+
class="inline-flex items-center px-1 border-b-2 text-sm font-medium"
|
|
37
|
+
:class="chatView ? 'text-content border-primary' : 'border-transparent text-content-tertiary hover:text-content'">Chat</a>
|
|
38
|
+
<span v-else class="inline-flex items-center px-1 border-b-2 border-transparent text-sm font-medium text-gray-300 cursor-not-allowed">
|
|
39
|
+
Chat
|
|
40
|
+
<svg class="h-4 w-4 ml-1" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
41
|
+
<path fill-rule="evenodd" d="M10 2a4 4 0 00-4 4v2H5a2 2 0 00-2 2v6a2 2 0 002 2h10a2 2 0 002-2v-6a2 2 0 00-2-2h-1V6a4 4 0 00-4-4zm-3 6V6a3 3 0 116 0v2H7z" clip-rule="evenodd" />
|
|
42
|
+
</svg>
|
|
43
|
+
</span>
|
|
44
|
+
<a
|
|
45
|
+
:href="hasTaskVisualizer"
|
|
46
|
+
class="inline-flex items-center px-1 border-b-2 text-sm font-medium"
|
|
47
|
+
:class="taskView ? 'text-content border-primary' : 'border-transparent text-content-tertiary hover:text-content'">
|
|
48
|
+
Tasks
|
|
49
|
+
</a>
|
|
50
|
+
<a
|
|
51
|
+
href="https://studio.mongoosejs.io/docs"
|
|
52
|
+
target="_blank"
|
|
53
|
+
rel="noopener noreferrer"
|
|
54
|
+
class="inline-flex items-center px-1 border-b-2 border-transparent text-sm font-medium text-content-tertiary hover:text-content"
|
|
55
|
+
>
|
|
56
|
+
Docs
|
|
57
|
+
</a>
|
|
58
|
+
</nav>
|
|
59
|
+
<!-- Right: Env Badge + User -->
|
|
60
|
+
<div class="flex items-center justify-end gap-3 self-center">
|
|
6
61
|
<div
|
|
7
62
|
v-if="!!state.nodeEnv"
|
|
8
63
|
title="NODE_ENV"
|
|
9
|
-
class="inline-flex items-center rounded px-2 py-1 text-xs text-
|
|
64
|
+
class="inline-flex items-center rounded px-2 py-1 text-xs text-content-tertiary bg-surface border border-edge gap-2"
|
|
10
65
|
>
|
|
11
66
|
<span
|
|
12
67
|
:class="warnEnv ? 'bg-red-400' : 'bg-yellow-400'"
|
|
@@ -15,94 +70,77 @@
|
|
|
15
70
|
></span>
|
|
16
71
|
<span>{{state.nodeEnv}}</span>
|
|
17
72
|
</div>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
</
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
class="
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
Chat
|
|
47
|
-
<svg class="h-4 w-4 ml-1" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
48
|
-
<path fill-rule="evenodd" d="M10 2a4 4 0 00-4 4v2H5a2 2 0 00-2 2v6a2 2 0 002 2h10a2 2 0 002-2v-6a2 2 0 00-2-2h-1V6a4 4 0 00-4-4zm-3 6V6a3 3 0 116 0v2H7z" clip-rule="evenodd" />
|
|
49
|
-
</svg>
|
|
50
|
-
</span>
|
|
51
|
-
<a
|
|
52
|
-
:href="hasTaskVisualizer"
|
|
53
|
-
class="inline-flex items-center border-b-2 px-1 pt-1 text-sm font-medium"
|
|
54
|
-
:class="taskView ? 'text-gray-900 border-ultramarine-500' : 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700'">
|
|
55
|
-
Tasks
|
|
56
|
-
</a>
|
|
57
|
-
<a
|
|
58
|
-
href="https://studio.mongoosejs.io/docs"
|
|
59
|
-
target="_blank"
|
|
60
|
-
rel="noopener noreferrer"
|
|
61
|
-
class="inline-flex items-center border-b-2 px-1 pt-1 text-sm font-medium text-gray-500 hover:border-gray-300 hover:text-gray-700 border-transparent"
|
|
62
|
-
>
|
|
63
|
-
Docs
|
|
64
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="ml-1 h-4 w-4" viewBox="0 -960 960 960" fill="currentColor"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z"/></svg>
|
|
65
|
-
</a>
|
|
73
|
+
<button
|
|
74
|
+
v-if="!user || !hasAPIKey"
|
|
75
|
+
type="button"
|
|
76
|
+
@click="toggleDarkMode"
|
|
77
|
+
:title="darkMode ? 'Switch to light mode' : 'Switch to dark mode'"
|
|
78
|
+
class="inline-flex items-center justify-center rounded-md p-2 text-content-tertiary hover:text-content-secondary hover:bg-muted"
|
|
79
|
+
aria-label="Toggle dark mode">
|
|
80
|
+
<svg v-if="darkMode" xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
81
|
+
<path d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z"/>
|
|
82
|
+
</svg>
|
|
83
|
+
<svg v-else xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
84
|
+
<path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"/>
|
|
85
|
+
</svg>
|
|
86
|
+
</button>
|
|
87
|
+
<div class="flex items-center" v-if="!user && hasAPIKey">
|
|
88
|
+
<button
|
|
89
|
+
type="button"
|
|
90
|
+
@click="loginWithGithub"
|
|
91
|
+
class="rounded bg-primary px-2 py-2 text-sm font-semibold text-primary-text shadow-sm hover:bg-primary-hover focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary">
|
|
92
|
+
Login
|
|
93
|
+
</button>
|
|
94
|
+
</div>
|
|
95
|
+
<div v-if="user && hasAPIKey" class="flex items-center relative" v-clickOutside="hideFlyout">
|
|
96
|
+
<button type="button" @click="showFlyout = !showFlyout" class="relative flex rounded-full text-sm focus:outline-none focus:ring-2 focus:ring-gray-300" id="user-menu-button" aria-expanded="false" aria-haspopup="true">
|
|
97
|
+
<span class="absolute -inset-1.5"></span>
|
|
98
|
+
<span class="sr-only">Open user menu</span>
|
|
99
|
+
<img class="size-8 rounded-full" :src="user.picture" alt="">
|
|
100
|
+
</button>
|
|
66
101
|
|
|
67
|
-
<div
|
|
102
|
+
<div
|
|
103
|
+
v-if="showFlyout"
|
|
104
|
+
class="absolute right-0 top-[90%] w-48 origin-top-right rounded-md bg-surface py-1 shadow-lg ring-1 ring-black/5 focus:outline-none"
|
|
105
|
+
role="menu"
|
|
106
|
+
aria-orientation="vertical"
|
|
107
|
+
aria-labelledby="user-menu-button"
|
|
108
|
+
style="z-index: 10000"
|
|
109
|
+
tabindex="-1">
|
|
68
110
|
<button
|
|
69
111
|
type="button"
|
|
70
|
-
@click="
|
|
71
|
-
class="
|
|
72
|
-
|
|
73
|
-
</button>
|
|
74
|
-
</div>
|
|
75
|
-
<div v-if="user && hasAPIKey" class="h-full flex items-center relative" v-clickOutside="hideFlyout">
|
|
76
|
-
<div>
|
|
77
|
-
<button type="button" @click="showFlyout = !showFlyout" class="relative flex rounded-full bg-gray-800 text-sm focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-gray-800" id="user-menu-button" aria-expanded="false" aria-haspopup="true">
|
|
78
|
-
<span class="absolute -inset-1.5"></span>
|
|
79
|
-
<span class="sr-only">Open user menu</span>
|
|
80
|
-
<img class="size-8 rounded-full" :src="user.picture" alt="">
|
|
81
|
-
</button>
|
|
82
|
-
</div>
|
|
83
|
-
|
|
84
|
-
<div
|
|
85
|
-
v-if="showFlyout"
|
|
86
|
-
class="absolute right-0 top-[90%] w-48 origin-top-right rounded-md bg-white py-1 shadow-lg ring-1 ring-black/5 focus:outline-none"
|
|
87
|
-
role="menu"
|
|
88
|
-
aria-orientation="vertical"
|
|
89
|
-
aria-labelledby="user-menu-button"
|
|
90
|
-
style="z-index: 10000"
|
|
112
|
+
@click="toggleDarkMode(); showFlyout = false"
|
|
113
|
+
class="w-full cursor-pointer block px-4 py-2 text-sm text-content-secondary hover:bg-primary-subtle text-left flex items-center gap-2"
|
|
114
|
+
role="menuitem"
|
|
91
115
|
tabindex="-1">
|
|
92
|
-
<
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
<
|
|
100
|
-
|
|
116
|
+
<svg v-if="darkMode" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 20 20" fill="currentColor"><path d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z"/></svg>
|
|
117
|
+
<svg v-else xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 20 20" fill="currentColor"><path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"/></svg>
|
|
118
|
+
{{ darkMode ? 'Light mode' : 'Dark mode' }}
|
|
119
|
+
</button>
|
|
120
|
+
<router-link to="/team" v-if="hasAccess(roles, 'team')" @click="showFlyout = false" class="cursor-pointer block px-4 py-2 text-sm text-content-secondary hover:bg-primary-subtle" role="menuitem" tabindex="-1" id="user-menu-item-2">Team</router-link>
|
|
121
|
+
<span v-else class="block px-4 py-2 text-sm text-gray-300 cursor-not-allowed" role="menuitem" tabindex="-1" id="user-menu-item-2">
|
|
122
|
+
Team
|
|
123
|
+
<svg class="h-4 w-4 ml-1 inline" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
124
|
+
<path fill-rule="evenodd" d="M10 2a4 4 0 00-4 4v2H5a2 2 0 00-2 2v6a2 2 0 002 2h10a2 2 0 002-2v-6a2 2 0 00-2-2h-1V6a4 4 0 00-4-4zm-3 6V6a3 3 0 116 0v2H7z" clip-rule="evenodd" />
|
|
125
|
+
</svg>
|
|
126
|
+
</span>
|
|
127
|
+
<span @click="logout" class="cursor-pointer block px-4 py-2 text-sm text-content-secondary hover:bg-primary-subtle" role="menuitem" tabindex="-1" id="user-menu-item-2">Sign out</span>
|
|
101
128
|
</div>
|
|
102
|
-
|
|
103
129
|
</div>
|
|
104
130
|
</div>
|
|
105
|
-
|
|
131
|
+
</div>
|
|
132
|
+
<!-- Mobile navbar -->
|
|
133
|
+
<div class="navbar w-full bg-page flex justify-between border-b border-edge !h-[55px] md:hidden">
|
|
134
|
+
<div class="flex items-center gap-2 pl-4">
|
|
135
|
+
<router-link class="flex items-center gap-2" :to="{ name: defaultRoute }">
|
|
136
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 text-primary" viewBox="0 0 250 250" fill="currentColor" aria-label="Mongoose Studio Logo">
|
|
137
|
+
<path d="M 241.66,125.01 C 237.81,112.98 227.41,111.95 216.76,110.36 C 215.12,95.83 210.99,83.09 202.29,70.33 C 202.99,68.37 201.92,66.65 200.74,65.11 C 183.14,41.46 157.52,27 124.66,27 C 92.62,27 66.09,40.77 48.28,63.38 C 46.21,65.85 46.26,67.71 47.12,69.36 C 37.81,81.15 33.21,93.78 30.99,109.86 C 20.19,110.58 11.71,115.92 9.04,124.94 C 3.28,145.66 5.62,157.95 10.01,169.16 C 16.14,184.65 29.12,186.31 36.04,185.81 C 42.48,185.68 44.94,184.31 44.72,182.11 C 44.26,177.79 41.01,165.31 41.01,149.12 C 41.01,138.22 43.19,127.74 46.21,117.7 C 47.51,113.33 44.66,112.05 39.16,110.28 C 41.01,96.88 45.88,84.85 52.61,73.79 C 55.17,75.56 58.07,74.88 59.61,72.71 C 75.86,54.31 97.89,45.16 124.61,45.16 C 149.71,45.16 171.91,55.91 189.29,73.47 C 191.95,76.59 193.91,76.67 197.6,74.42 C 204.93,86.26 208.28,98.24 208.98,110.39 C 203.84,111.81 201.28,113.19 202.92,118.61 C 206.51,128.99 207.92,137.93 207.92,148.73 C 207.92,162.11 204.8,174.71 202.84,182.71 C 201.92,186.23 204.31,186.91 210.79,186.99 H 213.91 C 225.87,186.61 235.39,180.64 239.49,169.05 C 244.83,155.26 245.08,138.01 241.66,125.01 Z"/>
|
|
138
|
+
<path d="M 124.71,70.81 C 79.63,70.81 47.49,107.12 47.49,148.72 C 47.49,169.16 56.41,188.19 73.71,200.61 L 73.96,200.77 C 77.43,177.81 84.16,162.21 95.29,145.42 C 92.04,137.09 91.71,130.87 92.62,120.83 C 93.81,111.23 96.08,107.12 102.19,107.68 C 110.04,108.87 117.98,116.18 126.22,124.96 C 139.89,124.05 157.81,131.25 178.33,139.09 C 183.11,140.86 183.72,142.63 182.97,148.33 C 179.45,160.93 170.86,166.63 158.11,174.05 C 143.09,183.07 141.13,199.42 153.88,220.09 L 153.96,221.01 L 154.71,221.17 C 181.31,208.43 201.34,181.01 201.34,148.72 C 201.34,108.15 169.29,70.81 124.71,70.81 Z"/>
|
|
139
|
+
</svg>
|
|
140
|
+
<span class="text-base font-semibold text-content">Mongoose Studio</span>
|
|
141
|
+
</router-link>
|
|
142
|
+
</div>
|
|
143
|
+
<div class="flex items-center">
|
|
106
144
|
<!-- Mobile menu toggle, controls the 'mobileMenuOpen' state. -->
|
|
107
145
|
<button type="button" id="open-mobile-menu" class="-ml-2 rounded-md p-2 pr-4 text-gray-400">
|
|
108
146
|
<span class="sr-only">Open menu</span>
|
|
@@ -115,10 +153,13 @@
|
|
|
115
153
|
<!-- Mobile menu mask -->
|
|
116
154
|
<div id="mobile-menu-mask" class="fixed inset-0 bg-black bg-opacity-40 z-40 hidden"></div>
|
|
117
155
|
<!-- Mobile menu drawer -->
|
|
118
|
-
<div id="mobile-menu" style="z-index:
|
|
119
|
-
<div class="flex items-center justify-between px-4 !h-[55px] border-b border-
|
|
156
|
+
<div id="mobile-menu" style="z-index: 10000" class="fixed inset-0 bg-page shadow-lg transform translate-x-full transition-transform duration-200 ease-in-out flex flex-col">
|
|
157
|
+
<div class="flex items-center justify-between px-4 !h-[55px] border-b border-edge">
|
|
120
158
|
<router-link :to="{ name: defaultRoute }">
|
|
121
|
-
<
|
|
159
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-[32px] text-primary" viewBox="0 0 250 250" fill="currentColor" aria-label="Mongoose Studio Logo">
|
|
160
|
+
<path d="M 241.66,125.01 C 237.81,112.98 227.41,111.95 216.76,110.36 C 215.12,95.83 210.99,83.09 202.29,70.33 C 202.99,68.37 201.92,66.65 200.74,65.11 C 183.14,41.46 157.52,27 124.66,27 C 92.62,27 66.09,40.77 48.28,63.38 C 46.21,65.85 46.26,67.71 47.12,69.36 C 37.81,81.15 33.21,93.78 30.99,109.86 C 20.19,110.58 11.71,115.92 9.04,124.94 C 3.28,145.66 5.62,157.95 10.01,169.16 C 16.14,184.65 29.12,186.31 36.04,185.81 C 42.48,185.68 44.94,184.31 44.72,182.11 C 44.26,177.79 41.01,165.31 41.01,149.12 C 41.01,138.22 43.19,127.74 46.21,117.7 C 47.51,113.33 44.66,112.05 39.16,110.28 C 41.01,96.88 45.88,84.85 52.61,73.79 C 55.17,75.56 58.07,74.88 59.61,72.71 C 75.86,54.31 97.89,45.16 124.61,45.16 C 149.71,45.16 171.91,55.91 189.29,73.47 C 191.95,76.59 193.91,76.67 197.6,74.42 C 204.93,86.26 208.28,98.24 208.98,110.39 C 203.84,111.81 201.28,113.19 202.92,118.61 C 206.51,128.99 207.92,137.93 207.92,148.73 C 207.92,162.11 204.8,174.71 202.84,182.71 C 201.92,186.23 204.31,186.91 210.79,186.99 H 213.91 C 225.87,186.61 235.39,180.64 239.49,169.05 C 244.83,155.26 245.08,138.01 241.66,125.01 Z"/>
|
|
161
|
+
<path d="M 124.71,70.81 C 79.63,70.81 47.49,107.12 47.49,148.72 C 47.49,169.16 56.41,188.19 73.71,200.61 L 73.96,200.77 C 77.43,177.81 84.16,162.21 95.29,145.42 C 92.04,137.09 91.71,130.87 92.62,120.83 C 93.81,111.23 96.08,107.12 102.19,107.68 C 110.04,108.87 117.98,116.18 126.22,124.96 C 139.89,124.05 157.81,131.25 178.33,139.09 C 183.11,140.86 183.72,142.63 182.97,148.33 C 179.45,160.93 170.86,166.63 158.11,174.05 C 143.09,183.07 141.13,199.42 153.88,220.09 L 153.96,221.01 L 154.71,221.17 C 181.31,208.43 201.34,181.01 201.34,148.72 C 201.34,108.15 169.29,70.81 124.71,70.81 Z"/>
|
|
162
|
+
</svg>
|
|
122
163
|
</router-link>
|
|
123
164
|
<button type="button" id="close-mobile-menu" class="text-gray-400 p-2 rounded-md">
|
|
124
165
|
<span class="sr-only">Close menu</span>
|
|
@@ -128,10 +169,21 @@
|
|
|
128
169
|
</button>
|
|
129
170
|
</div>
|
|
130
171
|
<nav class="flex-1 px-4 py-4 space-y-2">
|
|
172
|
+
<div class="flex items-center gap-2 px-3 py-2" v-if="!user || !hasAPIKey">
|
|
173
|
+
<button
|
|
174
|
+
type="button"
|
|
175
|
+
@click="toggleDarkMode"
|
|
176
|
+
class="inline-flex items-center gap-2 rounded-md px-3 py-2 text-base font-medium text-content-secondary hover:bg-muted"
|
|
177
|
+
aria-label="Toggle dark mode">
|
|
178
|
+
<svg v-if="darkMode" xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z"/></svg>
|
|
179
|
+
<svg v-else xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"/></svg>
|
|
180
|
+
<span>{{ darkMode ? 'Light mode' : 'Dark mode' }}</span>
|
|
181
|
+
</button>
|
|
182
|
+
</div>
|
|
131
183
|
<a v-if="hasAccess(roles, 'root')"
|
|
132
184
|
href="#/"
|
|
133
185
|
class="block px-3 py-2 rounded-md text-base font-medium"
|
|
134
|
-
:class="documentView ? 'text-
|
|
186
|
+
:class="documentView ? 'text-content bg-primary-subtle' : 'text-content-secondary hover:bg-muted'">Documents</a>
|
|
135
187
|
<span v-else class="block px-3 py-2 rounded-md text-base font-medium text-gray-300 cursor-not-allowed">
|
|
136
188
|
Documents
|
|
137
189
|
<svg class="h-4 w-4 ml-1 inline" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
@@ -141,7 +193,7 @@
|
|
|
141
193
|
<a v-if="hasAccess(roles, 'dashboards')"
|
|
142
194
|
href="#/dashboards"
|
|
143
195
|
class="block px-3 py-2 rounded-md text-base font-medium"
|
|
144
|
-
:class="dashboardView ? 'text-
|
|
196
|
+
:class="dashboardView ? 'text-content bg-primary-subtle' : 'text-content-secondary hover:bg-muted'">Dashboards</a>
|
|
145
197
|
<span v-else class="block px-3 py-2 rounded-md text-base font-medium text-gray-300 cursor-not-allowed">
|
|
146
198
|
Dashboards
|
|
147
199
|
<svg class="h-4 w-4 ml-1 inline" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
@@ -151,7 +203,7 @@
|
|
|
151
203
|
<a v-if="hasAccess(roles, 'chat')"
|
|
152
204
|
href="#/chat"
|
|
153
205
|
class="block px-3 py-2 rounded-md text-base font-medium"
|
|
154
|
-
:class="chatView ? 'text-
|
|
206
|
+
:class="chatView ? 'text-content bg-primary-subtle' : 'text-content-secondary hover:bg-muted'">Chat</a>
|
|
155
207
|
<span v-else class="block px-3 py-2 rounded-md text-base font-medium text-gray-300 cursor-not-allowed">
|
|
156
208
|
Chat
|
|
157
209
|
<svg class="h-4 w-4 ml-1 inline" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
@@ -162,24 +214,32 @@
|
|
|
162
214
|
<button
|
|
163
215
|
type="button"
|
|
164
216
|
@click="loginWithGithub"
|
|
165
|
-
class="w-full rounded bg-
|
|
217
|
+
class="w-full rounded bg-muted text-content px-3 py-2 text-base font-semibold shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary">
|
|
166
218
|
Login
|
|
167
219
|
</button>
|
|
168
220
|
</div>
|
|
169
221
|
<div v-if="user && hasAPIKey" class="mt-4">
|
|
170
|
-
<div class="flex items-center gap-3 px-3 py-2 bg-
|
|
222
|
+
<div class="flex items-center gap-3 px-3 py-2 bg-page rounded-md">
|
|
171
223
|
<img class="size-8 rounded-full" :src="user.picture" alt="">
|
|
172
|
-
<span class="text-
|
|
224
|
+
<span class="text-content font-medium">{{ user.name }}</span>
|
|
173
225
|
</div>
|
|
174
226
|
<div class="mt-2 space-y-1">
|
|
175
|
-
<
|
|
227
|
+
<button
|
|
228
|
+
type="button"
|
|
229
|
+
@click="toggleDarkMode"
|
|
230
|
+
class="w-full inline-flex items-center gap-2 px-3 py-2 rounded-md text-base text-content-secondary hover:bg-primary-subtle text-left">
|
|
231
|
+
<svg v-if="darkMode" xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z"/></svg>
|
|
232
|
+
<svg v-else xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"/></svg>
|
|
233
|
+
{{ darkMode ? 'Light mode' : 'Dark mode' }}
|
|
234
|
+
</button>
|
|
235
|
+
<router-link to="/team" v-if="hasAccess(roles, 'team')" class="block px-3 py-2 rounded-md text-base text-content-secondary hover:bg-primary-subtle">Team</router-link>
|
|
176
236
|
<span v-else class="block px-3 py-2 rounded-md text-base text-gray-300 cursor-not-allowed">
|
|
177
237
|
Team
|
|
178
238
|
<svg class="h-4 w-4 ml-1 inline" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
179
239
|
<path fill-rule="evenodd" d="M10 2a4 4 0 00-4 4v2H5a2 2 0 00-2 2v6a2 2 0 002 2h10a2 2 0 002-2v-6a2 2 0 00-2-2h-1V6a4 4 0 00-4-4zm-3 6V6a3 3 0 116 0v2H7z" clip-rule="evenodd" />
|
|
180
240
|
</svg>
|
|
181
241
|
</span>
|
|
182
|
-
<span @click="logout" class="block px-3 py-2 rounded-md text-base text-
|
|
242
|
+
<span @click="logout" class="block px-3 py-2 rounded-md text-base text-content-secondary hover:bg-primary-subtle cursor-pointer">Sign out</span>
|
|
183
243
|
</div>
|
|
184
244
|
</div>
|
|
185
245
|
</nav>
|