Skip to content

Commit

Permalink
Add "Get Started" to Help menu
Browse files Browse the repository at this point in the history
  • Loading branch information
probablykasper committed Jan 21, 2024
1 parent f8e9077 commit 7ce701b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
5 changes: 4 additions & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,10 @@ async fn main() {
)),
MenuEntry::Submenu(Submenu::new(
"Help",
Menu::with_items([CustomMenuItem::new("Learn More", "Learn More").into()]),
Menu::with_items([
CustomMenuItem::new("Get Started", "Get Started").into(),
CustomMenuItem::new("Learn More", "Learn More").into(),
]),
)),
]))
.on_menu_event(|event| match event.menu_item_id() {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/modals/GetStarted.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import Button from '$lib/Button.svelte'
import Link from '$lib/Link.svelte'
export let visible = true
export let visible = false
</script>

{#if visible}
Expand Down
25 changes: 14 additions & 11 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<script lang="ts" context="module">
let getStartedWasShown = false
</script>

<script lang="ts">
import { event } from '@tauri-apps/api'
import { checkShortcut, checkModifiers } from '$lib/general'
Expand Down Expand Up @@ -65,20 +69,21 @@
goto('/', { replaceState: true })
$viewOptions.show_all = true
$viewOptions.show_archived = false
} else if (payload === 'Get Started') {
showGetStarted = true
}
})
onDestroy(async () => {
const unlisten = await unlistenFuture
unlisten()
})
let getStartedWasSeen = false
$: if (
!getStartedWasSeen &&
$settings &&
$settings.channels.length === 0 &&
$settings.api_key === ''
) {
getStartedWasSeen = true
let showGetStarted = false
$: if (showGetStarted) {
getStartedWasShown = true
}
$: if (!getStartedWasShown && $settings?.channels.length === 0 && $settings.api_key === '') {
showGetStarted = true
}
</script>

Expand All @@ -94,9 +99,7 @@
bind:visible={$settingsOpen}
/>

{#if getStartedWasSeen}
<GetStarted />
{/if}
<GetStarted bind:visible={showGetStarted} />
{:else if error}
Error loading.

Expand Down

0 comments on commit 7ce701b

Please sign in to comment.