Skip to content

Commit 3f4abe5

Browse files
authored
fix: web component server list error (#781)
* chore: update app * fix: web component server list error * feat: add * chore: remove defalut version
1 parent 060c09e commit 3f4abe5

7 files changed

Lines changed: 56 additions & 16 deletions

File tree

src/components/Assistant/ServerList.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ export function ServerList({ clearChat }: ServerListProps) {
8080
);
8181

8282
useEffect(() => {
83+
if (!isTauri) return;
84+
8385
fetchServers(true);
8486
}, [currentService?.enabled]);
8587

src/components/Common/UI/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export default function Footer({ setIsPinnedWeb }: FooterProps) {
116116
) : (
117117
sourceData?.source?.name ||
118118
t("search.footer.version", {
119-
version: process.env.VERSION || "v1.0.0",
119+
version: process.env.VERSION || "N/A",
120120
})
121121
)}
122122
</div>

src/components/Common/UI/SettingsFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const Footer = () => {
8383

8484
<div className="flex items-center space-x-4">
8585
<span className="text-xs text-gray-500 dark:text-gray-400">
86-
Version {process.env.VERSION || "v1.0.0"}
86+
Version {process.env.VERSION || "N/A"}
8787
</span>
8888
{/* <div className="h-4 w-px bg-gray-200 dark:bg-gray-700" />
8989
<button className="text-xs text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors">

src/components/Settings/AboutView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default function AboutView() {
4444
</div>
4545
<div className="mt-8 text-sm text-gray-500 dark:text-gray-400">
4646
{t("settings.about.version", {
47-
version: process.env.VERSION || "v1.0.0",
47+
version: process.env.VERSION || "N/A",
4848
})}
4949
</div>
5050
<div className="mt-4 text-sm text-gray-500 dark:text-gray-400">

src/components/UpdateApp/index.tsx

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,15 @@ interface UpdateAppProps {
2929
const UpdateApp = ({ isCheckPage }: UpdateAppProps) => {
3030
const { t } = useTranslation();
3131
const isDark = useThemeStore((state) => state.isDark);
32-
const { visible, setVisible, skipVersion, setSkipVersion, isOptional, updateInfo, setUpdateInfo } = useUpdateStore();
32+
const {
33+
visible,
34+
setVisible,
35+
skipVersion,
36+
setSkipVersion,
37+
isOptional,
38+
updateInfo,
39+
setUpdateInfo,
40+
} = useUpdateStore();
3341
const addError = useAppStore((state) => state.addError);
3442
const snapshotUpdate = useAppearanceStore((state) => state.snapshotUpdate);
3543

@@ -125,44 +133,73 @@ const UpdateApp = ({ isCheckPage }: UpdateAppProps) => {
125133
className="relative z-10 focus:outline-none"
126134
onClose={noop}
127135
>
128-
<div className={`fixed inset-0 z-10 w-screen overflow-y-auto ${isCheckPage ? "rounded-lg bg-white dark:bg-[#333] border border-[#EDEDED] dark:border-black/20 shadow-md" : ""}`}>
129-
<div className={clsx("flex min-h-full items-center justify-center", !isCheckPage && "p-4")}>
136+
<div
137+
className={`fixed inset-0 z-10 w-screen overflow-y-auto ${
138+
isCheckPage
139+
? "rounded-lg bg-white dark:bg-[#333] border border-[#EDEDED] dark:border-black/20 shadow-md"
140+
: ""
141+
}`}
142+
>
143+
<div
144+
className={clsx(
145+
"flex min-h-full items-center justify-center",
146+
!isCheckPage && "p-4"
147+
)}
148+
>
130149
<DialogPanel
131150
transition
132-
className={`relative w-[340px] py-8 flex flex-col items-center ${isCheckPage ? "" : "rounded-lg bg-white dark:bg-[#333] border border-[#EDEDED] dark:border-black/20 shadow-md"}`}
151+
className={`relative w-[340px] py-8 flex flex-col items-center ${
152+
isCheckPage
153+
? ""
154+
: "rounded-lg bg-white dark:bg-[#333] border border-[#EDEDED] dark:border-black/20 shadow-md"
155+
}`}
133156
>
134157
{!isCheckPage && isOptional && (
135158
<X
136-
className={clsx("absolute size-5 top-3 right-3 text-[#999] dark:text-[#D8D8D8]", cursorClassName)}
159+
className={clsx(
160+
"absolute size-5 top-3 right-3 text-[#999] dark:text-[#D8D8D8]",
161+
cursorClassName
162+
)}
137163
onClick={handleCancel}
164+
role="button"
165+
aria-label="Close dialog"
166+
tabIndex={0}
138167
/>
139168
)}
140169

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

143172
<div className="text-[#333] text-sm leading-5 py-2 dark:text-[#D8D8D8] text-center">
144173
{updateInfo?.available ? (
145-
isOptional ? t("update.optional_description") : (
174+
isOptional ? (
175+
t("update.optional_description")
176+
) : (
146177
<>
147178
<p>{t("update.force_description1")}</p>
148179
<p>{t("update.force_description2")}</p>
149180
</>
150181
)
151-
) : t("update.date")}
182+
) : (
183+
t("update.date")
184+
)}
152185
</div>
153186

154187
{updateInfo?.available ? (
155188
<div
156189
className="text-xs text-[#0072FF] cursor-pointer"
157190
onClick={() =>
158-
OpenURLWithBrowser("https://docs.infinilabs.com/coco-app/main/docs/release-notes")
191+
OpenURLWithBrowser(
192+
"https://docs.infinilabs.com/coco-app/main/docs/release-notes"
193+
)
159194
}
160195
>
161196
v{updateInfo.version} {t("update.releaseNotes")}
162197
</div>
163198
) : (
164199
<div className={clsx("text-xs text-[#999]", cursorClassName)}>
165-
{t("update.latest", { replace: [updateInfo?.version || "v0.6.0"] })}
200+
{t("update.latest", {
201+
replace: [updateInfo?.version || process.env.VERSION || "N/A"],
202+
})}
166203
</div>
167204
)}
168205

@@ -179,7 +216,11 @@ const UpdateApp = ({ isCheckPage }: UpdateAppProps) => {
179216
<LoaderCircle className="animate-spin size-5" />
180217
{percent}%
181218
</div>
182-
) : updateInfo?.available ? t("update.button.install") : t("update.button.ok")}
219+
) : updateInfo?.available ? (
220+
t("update.button.install")
221+
) : (
222+
t("update.button.ok")
223+
)}
183224
</Button>
184225

185226
{updateInfo?.available && isOptional && (
@@ -194,7 +235,6 @@ const UpdateApp = ({ isCheckPage }: UpdateAppProps) => {
194235
</div>
195236
</div>
196237
</Dialog>
197-
198238
);
199239
};
200240

src/stores/updateStore.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export const useUpdateStore = create<IUpdateStore>()(
3434
name: "update-store",
3535
partialize: (state) => ({
3636
skipVersion: state.skipVersion,
37-
updateInfo: state.updateInfo,
3837
}),
3938
}
4039
)

src/utils/webAdapter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ export const createWebAdapter = (): WebPlatformAdapter => {
111111
},
112112

113113
async checkUpdate() {
114-
console.log("Web mode simulated check update");
115114
return null;
116115
},
117116

0 commit comments

Comments
 (0)