Skip to content

Commit ff6318c

Browse files
committed
feat: api update
1 parent 6818793 commit ff6318c

File tree

2 files changed

+356
-353
lines changed

2 files changed

+356
-353
lines changed

src/routes/settings.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default function SettingsPage() {
7979
? {
8080
...config,
8181
site_name: config.site_name || "",
82-
user_template: config.user_template || Object.keys(config.user_templates || {})[0] || "user-dist",
82+
user_template: config.user_template || Object.keys(config.frontend_templates || {})[0] || "user-dist",
8383
}
8484
: {
8585
ip_change_notification_group_id: 0,
@@ -111,7 +111,7 @@ export default function SettingsPage() {
111111
} finally {
112112
if (values.language != i18n.language) {
113113
i18n.changeLanguage(values.language);
114-
}
114+
}
115115
toast(t("Success"));
116116
}
117117
};
@@ -168,12 +168,12 @@ export default function SettingsPage() {
168168
<FormItem>
169169
<FormLabel>{t("Theme")}</FormLabel>
170170
<FormControl>
171-
<Select
171+
<Select
172172
value={field.value}
173173
onValueChange={(value) => {
174-
const template = config?.user_templates?.find(t => t.path === value);
174+
const template = config?.frontend_templates?.find(t => t.path === value);
175175
if (template) {
176-
form.setValue("user_template", template.path);
176+
form.setValue("user_template", template.path ?? '');
177177
}
178178
}}
179179
>
@@ -183,18 +183,18 @@ export default function SettingsPage() {
183183
</SelectTrigger>
184184
</FormControl>
185185
<SelectContent>
186-
{(config?.user_templates || []).map((template) => (
186+
{(config?.frontend_templates?.filter(t => !t.is_admin) || []).map((template) => (
187187
<div key={template.path}>
188-
<SelectItem value={template.path}>
188+
<SelectItem value={template.path!}>
189189
<div className="flex flex-col items-start gap-1">
190190
<div className="font-medium">{template.name}</div>
191191
<div className="flex items-center gap-2 text-sm text-muted-foreground">
192192
<span>{t("Author")}: {template.author}</span>
193-
{template.community ? (
193+
{!template.is_official ? (
194194
<span className="px-1.5 py-0.5 rounded-md bg-red-100 text-red-800 text-xs">
195195
{t("Community")}
196196
</span>
197-
): (
197+
) : (
198198
<span className="px-1.5 py-0.5 rounded-md bg-blue-100 text-blue-800 text-xs">
199199
{t("Official")}
200200
</span>
@@ -203,7 +203,7 @@ export default function SettingsPage() {
203203
</div>
204204
</SelectItem>
205205
<div className="px-8 py-1">
206-
<a
206+
<a
207207
href={template.repository}
208208
target="_blank"
209209
rel="noopener noreferrer"
@@ -218,7 +218,7 @@ export default function SettingsPage() {
218218
</Select>
219219
</FormControl>
220220
<FormMessage />
221-
{config?.user_templates?.find(t => t.path === field.value)?.community && (
221+
{!config?.frontend_templates?.find(t => t.path === field.value)?.is_official && (
222222
<div className="mt-2 text-sm text-yellow-700 dark:text-yellow-200 bg-yellow-100 dark:bg-yellow-900 border border-yellow-200 dark:border-yellow-700 rounded-md p-2">
223223
<div className="font-medium text-lg mb-1">{t("CommunityThemeWarning")}</div>
224224
<div className="text-yellow-700 dark:text-yellow-200">{t("CommunityThemeDescription")}</div>

0 commit comments

Comments
 (0)