Skip to content

Commit 69d2b4b

Browse files
authored
chore: add message for latest version check (#703)
* chore: add message for latest version check * docs: update notes
1 parent 6837286 commit 69d2b4b

File tree

4 files changed

+55
-59
lines changed

4 files changed

+55
-59
lines changed

docs/content.en/docs/release-notes/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Information about release notes of Coco Server is provided here.
2828
- refactor: refactoring search api #679
2929
- chore: continue to chat page display #690
3030
- chore: improve server list selection with enter key #692
31+
- chore: add message for latest version check #703
3132

3233
## 0.5.0 (2025-06-13)
3334

src/components/UpdateApp/index.tsx

Lines changed: 43 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -126,86 +126,75 @@ const UpdateApp = ({ isCheckPage }: UpdateAppProps) => {
126126
onClose={noop}
127127
>
128128
<div className="fixed inset-0 z-10 w-screen overflow-y-auto">
129-
<div
130-
className={clsx(
131-
"flex min-h-full items-center justify-center",
132-
{
133-
"p-4": !isCheckPage,
134-
}
135-
)}>
129+
<div className={clsx("flex min-h-full items-center justify-center", !isCheckPage && "p-4")}>
136130
<DialogPanel
137131
transition
138-
className={clsx(
139-
"relative w-[340px] py-8 flex flex-col items-center bg-white shadow-md border border-[#EDEDED] rounded-lg dark:bg-[#333] dark:border-black/20",
140-
)}
132+
className={`relative w-[340px] py-8 flex flex-col items-center bg-white shadow-md border border-[#EDEDED] dark:bg-[#333] dark:border-black/20 ${isCheckPage ? "" : "rounded-lg"}`}
141133
>
142-
{isCheckPage ? null : <X
143-
className={clsx(
144-
"absolute size-5 text-[#999] top-3 right-3 dark:text-[#D8D8D8]",
145-
cursorClassName,
146-
{
147-
hidden: !isOptional,
148-
}
149-
)}
150-
onClick={handleCancel}
151-
/>}
134+
{!isCheckPage && isOptional && (
135+
<X
136+
className={clsx("absolute size-5 top-3 right-3 text-[#999] dark:text-[#D8D8D8]", cursorClassName)}
137+
onClick={handleCancel}
138+
/>
139+
)}
152140

153141
<img src={isDark ? darkIcon : lightIcon} className="h-6" />
154142

155-
<div className="text-[#333] text-sm leading-5 py-2 dark:text-[#D8D8D8]">
156-
{isOptional ? (
157-
t("update.optional_description")
158-
) : (
159-
<div className="leading-5 text-center">
160-
<p>{t("update.force_description1")}</p>
161-
<p>{t("update.force_description2")}</p>
162-
</div>
163-
)}
143+
<div className="text-[#333] text-sm leading-5 py-2 dark:text-[#D8D8D8] text-center">
144+
{updateInfo?.available ? (
145+
isOptional ? t("update.optional_description") : (
146+
<>
147+
<p>{t("update.force_description1")}</p>
148+
<p>{t("update.force_description2")}</p>
149+
</>
150+
)
151+
) : t("update.date")}
164152
</div>
165153

166-
<div
167-
className="text-xs text-[#0072FF] cursor-pointer"
168-
onClick={() => {
169-
OpenURLWithBrowser(
170-
"https://docs.infinilabs.com/coco-app/main/docs/release-notes"
171-
);
172-
}}
173-
>
174-
v{updateInfo?.version} {t("update.releaseNotes")}
175-
</div>
154+
{updateInfo?.available ? (
155+
<div
156+
className="text-xs text-[#0072FF] cursor-pointer"
157+
onClick={() =>
158+
OpenURLWithBrowser("https://docs.infinilabs.com/coco-app/main/docs/release-notes")
159+
}
160+
>
161+
v{updateInfo.version} {t("update.releaseNotes")}
162+
</div>
163+
) : (
164+
<div className={clsx("text-xs text-[#999]", cursorClassName)}>
165+
{t("update.latest", { replace: [updateInfo?.version] })}
166+
</div>
167+
)}
176168

177169
<Button
178170
className={clsx(
179171
"mb-3 mt-6 bg-[#0072FF] text-white text-sm px-[14px] py-[8px] rounded-lg",
180172
cursorClassName,
181-
{
182-
"opacity-50": state.loading,
183-
}
173+
state.loading && "opacity-50"
184174
)}
185-
onClick={handleDownload}
175+
onClick={updateInfo?.available ? handleDownload : handleSkip}
186176
>
187177
{state.loading ? (
188178
<div className="flex justify-center items-center gap-2">
189179
<LoaderCircle className="animate-spin size-5" />
190180
{percent}%
191181
</div>
192-
) : (
193-
t("update.button.install")
194-
)}
182+
) : updateInfo?.available ? t("update.button.install") : t("update.button.ok")}
195183
</Button>
196184

197-
<div
198-
className={clsx("text-xs text-[#999]", cursorClassName, {
199-
hidden: !isOptional,
200-
})}
201-
onClick={handleSkip}
202-
>
203-
{t("update.skip_version")}
204-
</div>
185+
{updateInfo?.available && isOptional && (
186+
<div
187+
className={clsx("text-xs text-[#999]", cursorClassName)}
188+
onClick={handleSkip}
189+
>
190+
{t("update.skip_version")}
191+
</div>
192+
)}
205193
</DialogPanel>
206194
</div>
207195
</div>
208196
</Dialog>
197+
209198
);
210199
};
211200

src/locales/en/translation.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,12 @@
465465
"force_description2": "Please install the latest version to continue.",
466466
"releaseNotes": "Release Notes",
467467
"button": {
468-
"install": "Install"
468+
"install": "Install",
469+
"ok": "Ok"
469470
},
470-
"skip_version": "Skip this version"
471+
"skip_version": "Skip this version",
472+
"date": "You're up to date",
473+
"latest": "\"{{0}}\" is the latest version"
471474
},
472475
"error": {
473476
"message": "Sorry, there is an error in your Coco App. Please contact the administrator."

src/locales/zh/translation.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,9 +464,12 @@
464464
"force_description2": "请安装最新版本后继续使用。",
465465
"releaseNotes": "更新日志",
466466
"button": {
467-
"install": "安装"
467+
"install": "安装",
468+
"ok": ""
468469
},
469-
"skip_version": "跳过此版本"
470+
"skip_version": "跳过此版本",
471+
"date": "已是最新版本",
472+
"latest": "当前版本:\"{{0}}\""
470473
},
471474
"error": {
472475
"message": "抱歉,Coco 应用出现了错误。请联系管理员。"
@@ -503,4 +506,4 @@
503506
"remainder": "求余",
504507
"expression": "表达式"
505508
}
506-
}
509+
}

0 commit comments

Comments
 (0)