Skip to content

Commit 47d176a

Browse files
committed
feat: add entry page for quick access
1 parent 5fa52ce commit 47d176a

File tree

3 files changed

+44
-9
lines changed

3 files changed

+44
-9
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<template>
2+
<div class="h-full w-full flex items-center justify-center gap-5 lt-md:flex-col">
3+
<RouterLink
4+
to="/"
5+
class="flex flex-col gap-2 items-center justify-center h-40 min-w-40 rounded bg-gray:10 p4 hover:bg-gray/20"
6+
>
7+
<carbon:presentation-file class="text-3em op50" />
8+
Slides
9+
</RouterLink>
10+
<RouterLink
11+
to="/presenter"
12+
class="flex flex-col gap-2 items-center justify-center h-40 min-w-40 rounded bg-gray:10 p4 hover:bg-gray/20"
13+
>
14+
<carbon:user-speaker class="text-3em op50" />
15+
Presenter
16+
</RouterLink>
17+
<RouterLink
18+
to="/notes"
19+
class="flex flex-col gap-2 items-center justify-center h-40 min-w-40 rounded bg-gray:10 p4 hover:bg-gray/20"
20+
>
21+
<carbon:catalog class="text-3em op50" />
22+
Notes
23+
</RouterLink>
24+
</div>
25+
</template>

packages/client/routes.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,19 @@ if (__SLIDEV_FEATURE_PRESENTER__) {
4242
return { path: '' }
4343
}
4444
routes.push({ path: '/presenter/print', component: () => import('./internals/PresenterPrint.vue') })
45-
routes.push({
46-
name: 'notes',
47-
path: '/notes',
48-
component: () => import('./internals/NotesView.vue'),
49-
beforeEnter: passwordGuard,
50-
})
45+
if (__SLIDEV_HAS_SERVER__) {
46+
routes.push({
47+
name: 'entry',
48+
path: '/entry',
49+
component: () => import('./internals/EntrySelect.vue'),
50+
})
51+
routes.push({
52+
name: 'notes',
53+
path: '/notes',
54+
component: () => import('./internals/NotesView.vue'),
55+
beforeEnter: passwordGuard,
56+
})
57+
}
5158
routes.push({
5259
name: 'presenter',
5360
path: '/presenter/:no',
@@ -61,7 +68,9 @@ if (__SLIDEV_FEATURE_PRESENTER__) {
6168
}
6269

6370
export const router = createRouter({
64-
history: __SLIDEV_HASH_ROUTE__ ? createWebHashHistory(import.meta.env.BASE_URL) : createWebHistory(import.meta.env.BASE_URL),
71+
history: __SLIDEV_HASH_ROUTE__
72+
? createWebHashHistory(import.meta.env.BASE_URL)
73+
: createWebHistory(import.meta.env.BASE_URL),
6574
routes,
6675
})
6776

packages/slidev/node/cli.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ function printInfo(options: ResolvedSlidevOptions, port?: number, remote?: strin
540540
if (port) {
541541
const query = remote ? `?password=${remote}` : ''
542542
const presenterPath = `${options.data.config.routerMode === 'hash' ? '/#/' : '/'}presenter/${query}`
543+
const entryPath = `${options.data.config.routerMode === 'hash' ? '/#/' : '/'}entry${query}/`
543544
console.log()
544545
console.log(`${dim(' public slide show ')} > ${cyan(`http://localhost:${bold(port)}/`)}`)
545546
if (query)
@@ -555,12 +556,12 @@ function printInfo(options: ResolvedSlidevOptions, port?: number, remote?: strin
555556
.forEach(v => (v || [])
556557
.filter(details => String(details.family).slice(-1) === '4' && !details.address.includes('127.0.0.1'))
557558
.forEach(({ address }) => {
558-
lastRemoteUrl = `http://${address}:${port}${presenterPath}`
559+
lastRemoteUrl = `http://${address}:${port}${entryPath}`
559560
console.log(`${dim(' remote control ')} > ${blue(lastRemoteUrl)}`)
560561
}))
561562

562563
if (tunnelUrl) {
563-
lastRemoteUrl = `${tunnelUrl}${presenterPath}`
564+
lastRemoteUrl = `${tunnelUrl}${entryPath}`
564565
console.log(`${dim(' remote via tunnel')} > ${yellow(lastRemoteUrl)}`)
565566
}
566567
}

0 commit comments

Comments
 (0)