Skip to content

Commit 16459fd

Browse files
committed
designer updates for the ci themes
1 parent 6f795f5 commit 16459fd

File tree

10 files changed

+67
-28
lines changed

10 files changed

+67
-28
lines changed

apps/showcase/assets/styles/tailwind/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99

1010
.btn-design-outlined {
11-
@apply px-3 py-2 bg-transparent border border-gray-200 dark:border-gray-700 hover:border-gray-800 dark:hover:border-gray-500 text-black dark:text-white rounded-md font-medium cursor-pointer transition-colors duration-200 focus:outline focus:outline-offset-2 focus:outline-zinc-950 dark:focus:outline-white disabled:opacity-60;
11+
@apply px-3 py-2 bg-transparent border border-gray-200 dark:border-gray-700 hover:border-gray-800 dark:hover:border-gray-500 text-black dark:text-white rounded-md font-medium cursor-pointer disabled:cursor-auto transition-colors duration-200 focus:outline focus:outline-offset-2 focus:outline-zinc-950 dark:focus:outline-white disabled:opacity-60 disabled:hover:border-gray-200 dark:disabled:hover:border-gray-700;
1212
}
1313

1414
.icon-btn {

apps/showcase/components/layout/AppDesigner.vue

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,21 +121,23 @@ export default {
121121
}
122122
},
123123
async saveTheme(theme) {
124-
const { error } = await $fetch(this.designerApiUrl + '/theme/update', {
125-
method: 'PATCH',
126-
credentials: 'include',
127-
headers: {
128-
'X-CSRF-Token': this.$appState.designer.csrfToken
129-
},
130-
body: {
131-
key: theme.key,
132-
preset: theme.preset,
133-
config: theme.config
134-
}
135-
});
124+
if (theme.origin === 'web') {
125+
const { error } = await $fetch(this.designerApiUrl + '/theme/update', {
126+
method: 'PATCH',
127+
credentials: 'include',
128+
headers: {
129+
'X-CSRF-Token': this.$appState.designer.csrfToken
130+
},
131+
body: {
132+
key: theme.key,
133+
preset: theme.preset,
134+
config: theme.config
135+
}
136+
});
136137
137-
if (error) {
138-
this.$toast.add({ severity: 'error', summary: 'An error occured', detail: error.message, life: 3000 });
138+
if (error) {
139+
this.$toast.add({ severity: 'error', summary: 'An error occured', detail: error.message, life: 3000 });
140+
}
139141
}
140142
},
141143
applyTheme(theme) {
@@ -221,7 +223,8 @@ export default {
221223
key: data.t_key,
222224
name: data.t_name,
223225
preset: typeof data.t_preset === 'string' ? JSON.parse(data.t_preset) : data.t_preset,
224-
config: typeof data.t_config === 'string' ? JSON.parse(data.t_config) : data.t_config
226+
config: typeof data.t_config === 'string' ? JSON.parse(data.t_config) : data.t_config,
227+
origin: data.t_origin
225228
};
226229
227230
usePreset(this.$appState.designer.theme.preset);

apps/showcase/components/layout/designer/dashboard/DesignDashboard.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@
5151
<div v-for="theme of $appState.designer.themes" :key="theme.t_key" class="flex flex-col gap-2 relative">
5252
<button
5353
type="button"
54-
class="rounded-xl h-32 w-32 px-4 overflow-hidden text-ellipsis bg-transparent border border-surface-200 dark:border-surface-700 hover:border-surface-400 dark:hover:border-surface-500 text-black dark:text-white"
54+
class="relative rounded-xl h-32 w-32 px-4 overflow-hidden text-ellipsis bg-transparent border border-surface-200 dark:border-surface-700 hover:border-surface-400 dark:hover:border-surface-500 text-black dark:text-white"
5555
@click="loadTheme(theme)"
5656
>
5757
<span class="text-2xl uppercase font-bold">{{ abbrThemeName(theme) }}</span>
58+
59+
<span class="absolute bottom-2 start-0 text-xs text-muted-color ms-start w-full" v-if="theme.t_origin !== 'web'">View Only</span>
5860
</button>
5961
<div class="flex flex-col items-center gap-1">
6062
<div class="group flex items-center gap-2 relative">
@@ -63,11 +65,12 @@
6365
type="text"
6466
:class="['w-24 text-sm px-2 text-center pr-4t', { 'bg-red-50 dark:bg-red-500/30': !theme.t_name, 'bg-transparent': theme.t_name }]"
6567
maxlength="100"
68+
:disabled="theme.t_origin !== 'web'"
6669
@blur="renameTheme(theme)"
6770
@keydown.enter="onThemeNameEnterKey($event)"
6871
@keydown.escape="onThemeNameEscape($event)"
6972
/>
70-
<i class="hidden group-hover:block pi pi-pencil !text-xs absolute top-50 text-muted-color" style="right: 2px"></i>
73+
<i class="hidden group-hover:block pi pi-pencil !text-xs absolute top-50 text-muted-color" style="right: 2px" v-if="theme.t_origin === 'web'"></i>
7174
</div>
7275
<span class="text-muted-color text-xs">{{ formatTimestamp(theme.t_last_updated) }}</span>
7376
</div>
@@ -242,7 +245,7 @@ export default {
242245
}
243246
},
244247
async renameTheme(theme) {
245-
if (theme.t_name && theme.t_name.trim().length) {
248+
if (theme.t_name && theme.t_name.trim().length && theme.t_origin === 'web') {
246249
const { error } = await $fetch(this.designerApiUrl + '/theme/rename/' + theme.t_key, {
247250
method: 'PATCH',
248251
credentials: 'include',

apps/showcase/components/layout/designer/editor/DesignEditorFooter.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="flex justify-end gap-2">
33
<button type="button" @click="download" icon="pi pi-download" class="btn-design-outlined">Download</button>
4-
<button type="button" @click="apply" icon="pi pi-download" class="btn-design">Apply</button>
4+
<button type="button" @click="apply" icon="pi pi-download" class="btn-design" :disabled="$appState.designer.theme.origin !== 'web'">Apply</button>
55
</div>
66
</template>
77

apps/showcase/components/layout/designer/editor/DesignTokenField.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
optionLabel="label"
1919
:showEmptyMessage="false"
2020
appendTo="self"
21+
:disabled="$appState.designer.theme.origin !== 'web'"
2122
:pt="{
2223
pcInputText: {
2324
root: {

apps/showcase/components/layout/designer/editor/custom/DesignCustomTokens.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
</li>
2525
</ul>
2626
<div class="flex justify-between">
27-
<button type="button" @click="addToken" class="btn-design-outlined">Add New</button>
28-
<button type="button" @click="save" class="btn-design">Save</button>
27+
<button type="button" @click="addToken" class="btn-design-outlined" :disabled="$appState.designer.theme.origin !== 'web'">Add New</button>
28+
<button type="button" @click="save" class="btn-design" :disabled="$appState.designer.theme.origin !== 'web'">Save</button>
2929
</div>
3030
</template>
3131

apps/showcase/components/layout/designer/editor/primitive/DesignColors.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@
44
<section v-if="key !== 'borderRadius'" class="flex justify-between items-center mb-4 gap-8">
55
<div class="flex gap-2 items-center">
66
<span class="text-sm capitalize block w-20">{{ key }}</span>
7-
<input :value="designerService.resolveColor($appState.designer.theme.preset.primitive[key]['500'])" @input="onColorChange($event, key)" type="color" @blur="onBlur" />
7+
<input
8+
:value="designerService.resolveColor($appState.designer.theme.preset.primitive[key]['500'])"
9+
@input="onColorChange($event, key)"
10+
type="color"
11+
@blur="onBlur"
12+
:disabled="$appState.designer.theme.origin !== 'web'"
13+
:class="{ '!cursor-not-allowed': $appState.designer.theme.origin !== 'web' }"
14+
/>
815
</div>
916
<DesignColorPalette :value="$appState.designer.theme.preset.primitive[key]" />
1017
</section>

apps/showcase/components/layout/designer/editor/semantic/DesignGeneral.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33
<section class="flex justify-between items-center mb-5 gap-8">
44
<div class="flex gap-2 items-center">
55
<span class="text-sm">Primary</span>
6-
<input :value="primary" @input="onPrimaryColorChange($event)" type="color" class="w-0 h-0" @onBlur="onColorPickerBlur" />
6+
<input
7+
:value="primary"
8+
@input="onPrimaryColorChange($event)"
9+
type="color"
10+
class="w-0 h-0"
11+
@onBlur="onColorPickerBlur"
12+
:disabled="$appState.designer.theme.origin !== 'web'"
13+
:class="{ '!cursor-not-allowed': $appState.designer.theme.origin !== 'web' }"
14+
/>
715
</div>
816
<DesignColorPalette :value="$appState.designer.theme.preset.semantic.primary" />
917
</section>

apps/showcase/components/layout/designer/editor/semantic/colorscheme/DesignCSCommon.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
<section class="flex justify-between items-center mb-5 gap-8">
44
<div class="flex gap-2 items-center">
55
<span class="text-sm">Surface</span>
6-
<input :value="surface" @input="onSurfaceColorChange($event)" type="color" @blur="onColorPickerBlur" />
6+
<input
7+
:value="surface"
8+
@input="onSurfaceColorChange($event)"
9+
type="color"
10+
@blur="onColorPickerBlur"
11+
:disabled="$appState.designer.theme.origin !== 'web'"
12+
:class="{ '!cursor-not-allowed': $appState.designer.theme.origin !== 'web' }"
13+
/>
714
</div>
815
<DesignColorPalette :value="$colorScheme.surface" />
916
</section>

apps/showcase/components/layout/designer/editor/settings/DesignSettings.vue

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,24 @@
55
<div class="flex gap-4">
66
<div>
77
<div class="text-sm mb-1 font-semibold text-surface-950 dark:text-surface-0">Base</div>
8-
<select v-model="$appState.designer.theme.config.font_size" @change="changeBaseFontSize" class="appearance-none px-3 py-2 rounded-md border border-surface-300 dark:border-surface-700 w-20">
8+
<select
9+
v-model="$appState.designer.theme.config.font_size"
10+
@change="changeBaseFontSize"
11+
class="appearance-none px-3 py-2 rounded-md border border-surface-300 dark:border-surface-700 w-20"
12+
:disabled="$appState.designer.theme.origin !== 'web'"
13+
>
914
<option v-for="fontSize of fontSizes" :key="fontSize" :value="fontSize">{{ fontSize }}</option>
1015
</select>
1116
</div>
1217

1318
<div>
1419
<div class="text-sm mb-1 font-semibold text-surface-950 dark:text-surface-0">Family</div>
15-
<select v-model="$appState.designer.theme.config.font_family" @change="changeFont" class="appearance-none px-3 py-2 rounded-md border border-surface-300 dark:border-surface-700 w-48">
20+
<select
21+
v-model="$appState.designer.theme.config.font_family"
22+
@change="changeFont"
23+
class="appearance-none px-3 py-2 rounded-md border border-surface-300 dark:border-surface-700 w-48"
24+
:disabled="$appState.designer.theme.origin !== 'web'"
25+
>
1626
<option v-for="font of fonts" :key="font" :value="font">{{ font }}</option>
1727
</select>
1828
</div>
@@ -26,7 +36,7 @@
2636
</span>
2737
<div class="flex justify-start gap-2">
2838
<button type="button" @click="preview" class="btn-design-outlined disabled:pointer-events-none" :disabled="!$appState.designer.verified">Check for Updates</button>
29-
<button v-if="status === 'preview' && missingTokens.length > 0" type="button" @click="confirmMigration" class="btn-design">Migrate</button>
39+
<button v-if="status === 'preview' && missingTokens.length > 0" type="button" @click="confirmMigration" class="btn-design" :disabled="$appState.designer.theme.origin !== 'web'">Migrate</button>
3040
</div>
3141
<div v-if="status === 'preview'">
3242
<div v-if="missingTokens.length" class="p-3 bg-yellow-100 text-yellow-950 dark:bg-yellow-500/30 dark:text-yellow-100 font-medium mt-4 rounded-md leading-normal">

0 commit comments

Comments
 (0)