Fix edit theme dialog title logic (#2205)

* Fix edit theme dialog title logic

As you can see from the code and the actual behavior, both share the
same code whether adding or editing a theme. So why does the title show
up as "Edit Theme" no matter what? It does seem strange in a way.

This feature appears to have been added in v2.0.0, but no one seems to
have cared about the issue during the two years.

Nonetheless, when I realized this recently, I decided to fix it.
Hopefully this will make things clearer for those users who may not be
able to tell the difference.

Now, when the "Add theme" button is clicked, the dialog title will
show "Add theme". If you right-click on a user-created theme, the dialog
title will show "Edit theme".

* Apply suggestions from lyswhut

Simpler code

Co-authored-by: lyswhut <lyswhut@qq.com>

---------

Co-authored-by: lyswhut <lyswhut@qq.com>
pull/2206/head
3gf8jv4dv 2024-12-23 23:53:10 +08:00 committed by GitHub
parent 0f27e3ea42
commit 5bde54aac1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 5 deletions

View File

@ -686,7 +686,8 @@
"theme_edit_modal__remove_tip": "Do you really want to remove this theme?", "theme_edit_modal__remove_tip": "Do you really want to remove this theme?",
"theme_edit_modal__save_new": "Copy", "theme_edit_modal__save_new": "Copy",
"theme_edit_modal__select_bg_file": "Choose a background image", "theme_edit_modal__select_bg_file": "Choose a background image",
"theme_edit_modal__title": "Edit Theme", "theme_edit_modal__title_add": "Add Theme",
"theme_edit_modal__title_edit": "Edit Theme",
"theme_green": "Green", "theme_green": "Green",
"theme_grey": "Grey", "theme_grey": "Grey",
"theme_happy_new_year": "New Year", "theme_happy_new_year": "New Year",

View File

@ -686,7 +686,8 @@
"theme_edit_modal__remove_tip": "是否真的要移除这个主题?", "theme_edit_modal__remove_tip": "是否真的要移除这个主题?",
"theme_edit_modal__save_new": "另存", "theme_edit_modal__save_new": "另存",
"theme_edit_modal__select_bg_file": "选择背景图片", "theme_edit_modal__select_bg_file": "选择背景图片",
"theme_edit_modal__title": "编辑主题", "theme_edit_modal__title_add": "添加主题",
"theme_edit_modal__title_edit": "编辑主题",
"theme_green": "绿意盎然", "theme_green": "绿意盎然",
"theme_grey": "灰常美丽", "theme_grey": "灰常美丽",
"theme_happy_new_year": "新年快乐", "theme_happy_new_year": "新年快乐",

View File

@ -665,7 +665,7 @@
"theme_edit_modal__badge_tertiary": "第三顏色", "theme_edit_modal__badge_tertiary": "第三顏色",
"theme_edit_modal__bg_image": "背景圖片", "theme_edit_modal__bg_image": "背景圖片",
"theme_edit_modal__bg_image_add": "背景圖片:", "theme_edit_modal__bg_image_add": "背景圖片:",
"theme_edit_modal__bg_image_change": "背景圖片", "theme_edit_modal__bg_image_change": "更背景圖片",
"theme_edit_modal__bg_image_remove": "移除背景圖片", "theme_edit_modal__bg_image_remove": "移除背景圖片",
"theme_edit_modal__close_btn": "關閉", "theme_edit_modal__close_btn": "關閉",
"theme_edit_modal__control_btn": "左側控制按鈕顏色", "theme_edit_modal__control_btn": "左側控制按鈕顏色",
@ -686,7 +686,8 @@
"theme_edit_modal__remove_tip": "是否真的要移除這個主題?", "theme_edit_modal__remove_tip": "是否真的要移除這個主題?",
"theme_edit_modal__save_new": "另存", "theme_edit_modal__save_new": "另存",
"theme_edit_modal__select_bg_file": "選擇背景圖片", "theme_edit_modal__select_bg_file": "選擇背景圖片",
"theme_edit_modal__title": "編輯主題", "theme_edit_modal__title_add": "新增主題",
"theme_edit_modal__title_edit": "編輯主題",
"theme_green": "綠意盎然", "theme_green": "綠意盎然",
"theme_grey": "灰常美麗", "theme_grey": "灰常美麗",
"theme_happy_new_year": "新年快樂", "theme_happy_new_year": "新年快樂",

View File

@ -1,7 +1,7 @@
<template> <template>
<material-modal :show="modelValue" max-height="90%" teleport="#view" @close="handleCancel"> <material-modal :show="modelValue" max-height="90%" teleport="#view" @close="handleCancel">
<main :class="$style.main"> <main :class="$style.main">
<h2>{{ $t('theme_edit_modal__title') }}</h2> <h2>{{ themeId ? $t('theme_edit_modal__title_edit') : $t('theme_edit_modal__title_add') }}</h2>
<div class="scroll" :class="$style.content"> <div class="scroll" :class="$style.content">
<div :class="[$style.group, $style.base]"> <div :class="[$style.group, $style.base]">
<div :class="$style.groupContent"> <div :class="$style.groupContent">