瀏覽代碼

enh: option to disable update toast

Timothy J. Baek 6 月之前
父節點
當前提交
6cb41a38a6
共有 2 個文件被更改,包括 35 次插入3 次删除
  1. 34 2
      src/lib/components/chat/Settings/Interface.svelte
  2. 1 1
      src/routes/(app)/+layout.svelte

+ 34 - 2
src/lib/components/chat/Settings/Interface.svelte

@@ -34,6 +34,7 @@
 	let landingPageMode = '';
 	let chatBubble = true;
 	let chatDirection: 'LTR' | 'RTL' = 'LTR';
+	let showUpdateToast = true;
 
 	let showEmojiInCall = false;
 	let voiceInterruption = false;
@@ -49,7 +50,7 @@
 		saveSettings({ scrollOnBranchChange: scrollOnBranchChange });
 	};
 
-	const togglewidescreenMode = async () => {
+	const toggleWidescreenMode = async () => {
 		widescreenMode = !widescreenMode;
 		saveSettings({ widescreenMode: widescreenMode });
 	};
@@ -64,6 +65,11 @@
 		saveSettings({ landingPageMode: landingPageMode });
 	};
 
+	const toggleShowUpdateToast = async () => {
+		showUpdateToast = !showUpdateToast;
+		saveSettings({ showUpdateToast: showUpdateToast });
+	};
+
 	const toggleShowUsername = async () => {
 		showUsername = !showUsername;
 		saveSettings({ showUsername: showUsername });
@@ -159,7 +165,9 @@
 		autoTags = $settings.autoTags ?? true;
 
 		responseAutoCopy = $settings.responseAutoCopy ?? false;
+
 		showUsername = $settings.showUsername ?? false;
+		showUpdateToast = $settings.showUpdateToast ?? true;
 
 		showEmojiInCall = $settings.showEmojiInCall ?? false;
 		voiceInterruption = $settings.voiceInterruption ?? false;
@@ -315,7 +323,7 @@
 					<button
 						class="p-1 px-3 text-xs flex rounded transition"
 						on:click={() => {
-							togglewidescreenMode();
+							toggleWidescreenMode();
 						}}
 						type="button"
 					>
@@ -346,6 +354,30 @@
 				</div>
 			</div>
 
+			{#if $user.role === 'admin'}
+				<div>
+					<div class=" py-0.5 flex w-full justify-between">
+						<div class=" self-center text-xs">
+							{$i18n.t('Toast notifications for new updates')}
+						</div>
+
+						<button
+							class="p-1 px-3 text-xs flex rounded transition"
+							on:click={() => {
+								toggleShowUpdateToast();
+							}}
+							type="button"
+						>
+							{#if showUpdateToast === true}
+								<span class="ml-2 self-center">{$i18n.t('On')}</span>
+							{:else}
+								<span class="ml-2 self-center">{$i18n.t('Off')}</span>
+							{/if}
+						</button>
+					</div>
+				</div>
+			{/if}
+
 			<div>
 				<div class=" py-0.5 flex w-full justify-between">
 					<div class=" self-center text-xs">

+ 1 - 1
src/routes/(app)/+layout.svelte

@@ -231,7 +231,7 @@
 <SettingsModal bind:show={$showSettings} />
 <ChangelogModal bind:show={$showChangelog} />
 
-{#if version && compareVersion(version.latest, version.current)}
+{#if version && compareVersion(version.latest, version.current) && ($settings?.showUpdateToast ?? true)}
 	<div class=" absolute bottom-8 right-8 z-50" in:fade={{ duration: 100 }}>
 		<UpdateInfoToast
 			{version}