enh: option to disable update toast

This commit is contained in:
Timothy J. Baek 2024-10-21 00:30:29 -07:00
parent 47e377967e
commit 6cb41a38a6
2 changed files with 35 additions and 3 deletions

View File

@ -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">

View File

@ -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}