Skip to content

Commit a83a434

Browse files
committed
show first time helper modal
1 parent 3f08f5a commit a83a434

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

packages/main/src/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import './securityRestrictions';
1212
import { Twitch } from './workers/Twitch';
1313
import { WorkflowQueue } from './workers/WorkflowQueue';
1414
import { trayIcon } from './images';
15+
import { tellRenderer } from './helpers';
16+
import { get as generalStoreGet } from './stores/general';
17+
import { FIRST_TIME_APP_SUBJECT } from '~shared/global';
1518

1619
if (import.meta.env.VITE_SENTRY_DSN) {
1720
Sentry.init({
@@ -72,6 +75,12 @@ app
7275
.then(restoreOrCreateWindow)
7376
.catch((err) => console.error('Failed create window:', (err as Error).message))
7477
.then(async () => {
78+
if (generalStoreGet<boolean>('firstTimeInApp')) {
79+
tellRenderer({
80+
subject: FIRST_TIME_APP_SUBJECT,
81+
});
82+
}
83+
7584
// Set icon tray
7685
if (process.platform === 'win32') {
7786
app.setAppUserModelId('Streamflow');

packages/renderer/src/App.vue

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts" setup>
2-
import { useNotification, NButton } from 'naive-ui';
3-
import { onMounted } from 'vue';
2+
import { useNotification, NButton, NModal } from 'naive-ui';
3+
import { onMounted, ref } from 'vue';
44
import { type Router, useRouter } from 'vue-router';
55
import { type WorkerMessage } from '../../shared/WorkerMessage';
66
import {
@@ -18,9 +18,11 @@ import { useTwitch } from './stores/twitch';
1818
import ContextMenu from '/@/components/ContextMenu.vue';
1919
import { ObsWebSocketSubject } from '~shared/ObsWebSocketSettings';
2020
import { TwitchSubject } from '~shared/TwitchSettings';
21+
import { FIRST_TIME_APP_SUBJECT } from '~shared/global';
2122
2223
const APP_VERSION = import.meta.env.VITE_APP_VERSION;
2324
let router: Router;
25+
const showFirstTimeModal = ref(false);
2426
2527
onMounted(() => {
2628
const notification = useNotification();
@@ -40,6 +42,11 @@ onMounted(() => {
4042
rewards: JSON.parse(e.data.message!),
4143
});
4244
45+
break;
46+
}
47+
case FIRST_TIME_APP_SUBJECT: {
48+
showFirstTimeModal.value = true;
49+
4350
break;
4451
}
4552
}
@@ -106,6 +113,28 @@ onMounted(() => {
106113
<template>
107114
<context-menu />
108115

116+
<n-modal
117+
:show="showFirstTimeModal"
118+
:show-icon="false"
119+
preset="dialog"
120+
title="First time?"
121+
transform-origin="center">
122+
<div class="mb-6"></div>
123+
124+
<div class="!text-base">
125+
<p class="mb-4">Welcome to <strong class="text-primary">Streamflow</strong>, the open-source toolkit for streamers!</p>
126+
<p class="mb-2">Just a few things before getting started; you can change these behaviours in the app <strong>Settings</strong>.</p>
127+
<ol class="list-disc pl-8">
128+
<li>When you <strong>close the app</strong>, it will run in the background. You can force-close it in the tray icons</li>
129+
<li>By default the app will <strong>open with your computer start up</strong> in the tray icon, so you don't open it manually!</li>
130+
</ol>
131+
</div>
132+
133+
<template #action>
134+
<n-button type="primary" @click="showFirstTimeModal = false">Got it</n-button>
135+
</template>
136+
</n-modal>
137+
109138
<main id="router-content">
110139
<router-view></router-view>
111140
</main>

packages/shared/global.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
export const HTTP_SERVER_PORT = 28591;
2+
3+
export const FIRST_TIME_APP_SUBJECT = 'FIRST_TIME_APP';

0 commit comments

Comments
 (0)