Skip to content

Commit 00afaf6

Browse files
committed
fix: presentation mode fix
- no longer on side panel - presentation mode page lives in user space - updated build scripts (closes #194), presentation mode is a build type variable rather than runtime - updated docs - a few UI updates
1 parent d68e4c1 commit 00afaf6

15 files changed

Lines changed: 331 additions & 94 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ jobs:
172172
# Build the web app
173173
- name: Build web app
174174
run: |
175-
if ${{ github.ref == 'refs/heads/presentation'}}; then
175+
if ${{ github.ref == 'refs/heads/presentation' || secrets.EXP_DEPLOY_MODE == 'presentation' }}; then
176176
npm run build:present
177177
else
178178
npm run build

docs/coding/configuration.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ EXP_DEPLOY_HOST = "exps.mydomain.org"
399399
EXP_DEPLOY_PATH = "/home/user/exps.mydomain.org"
400400
EXP_DEPLOY_PORT = 22
401401
EXP_DEPLOY_USER = user
402+
EXP_DEPLOY_MODE = production
402403
SLACK_WEBHOOK_URL = https://hooks.slack.com/workflows/something
403404
SLACK_WEBHOOK_ERROR_URL= https://hooks.slack.com/workflows/somethingelse
404405
EXP_DEPLOY_KEY = "-----BEGIN RSA PRIVATE KEY-----\n-----END RSA PRIVATE KEY-----"
@@ -409,6 +410,8 @@ EXP_DEPLOY_KEY = "-----BEGIN RSA PRIVATE KEY-----\n-----END RSA PRIVATE
409410
- `EXP_DEPLOY_PATH` is the directory you upload your experiment to
410411
- `EXP_DEPLOY_PORT` is the ssh port for your server (usually 22)
411412
- `EXP_DEPLOY_USER` is the username for your server
413+
- `EXP_DEPLOY_MODE` is the mode of the deployment (production, development, or
414+
presentation)
412415
- `SLACK_WEBHOOK_URL` is the url for the Slack Webhook for posting deployment
413416
messages
414417
- `SLACK_WEBHOOK_ERROR_URL` is the url for the Slack Webhook for posting error

docs/presentation.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,31 +46,30 @@ mode website.
4646
## How to customize Presentation Mode
4747

4848
To customize this presentation mode page edit the
49-
`src/components/presentation_mode/PresentationModeHomePage.vue` component. You
50-
can add links to papers, hot link to different parts of your experiment, or add
51-
custom routes that help to visualize your data, etc...
49+
`src/userPresentationModeView.vue` component. You can add links to papers, hot
50+
link to different parts of your experiment, or add custom routes that help to
51+
visualize your data, etc...
5252

5353
## How to deploy in Presentation Mode
5454

55-
To deploy your project in presentation mode there are two options. The first is
56-
to create a new branch titled 'presentation' and push this to GitHub. This will
55+
To deploy your project in presentation mode there are two options:
56+
57+
### Option 1: Branch-based deployment
58+
59+
Create a new branch titled 'presentation' and push this to GitHub. This will
5760
generate a special "presentation mode" deployment and you'll receive a slack
5861
notification about when the website is ready. An example from the default
5962
<SmileText/> repo is
6063
[here](https://exps.gureckislab.org/nyuccl/smile/presentation/#/)
6164

62-
The second option is to edit `src/config/config.js` and change the line that
63-
reads
65+
### Option 2: Environment variable deployment
6466

65-
```
66-
mode: import.meta.env.MODE,
67-
```
67+
Set the `EXP_DEPLOY_MODE` environment variable in your local `.env.deploy.local`
68+
file to `'presentation'`. This can be done by:
6869

69-
to
70-
71-
```
72-
mode: 'presentation',
73-
```
70+
1. Create or edit the file `.env.deploy.local` in your project root
71+
2. Add the line: `EXP_DEPLOY_MODE = presentation`
72+
3. Run the update script: `npm run update_config`
7473

75-
When you next commit this change to your repo, the new site will be built in
76-
presentation mode. This can be done on any branch.
74+
When you next commit and push to any branch, the site will be built in
75+
presentation mode.

plugins/strip-devtool.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@ export default function stripDevToolPlugin() {
1515
if (id.endsWith('main.js')) {
1616
console.log(' ➜ processing main.js for mode:', config.mode)
1717

18-
if (config.mode !== 'development') {
19-
// Replace MainApp import with SmileApp import for production builds
18+
if (config.mode == 'development') {
19+
// Replace MainApp import with SmileApp import for developer mode builds
2020
const updatedSrc = src.replace(
21-
/import App from '@\/core\/SmileApp\.vue'/g,
22-
"import App from '@/core/MainApp.vue'"
21+
/import App from '@\/core\/MainApp\.vue'/g,
22+
"import App from '@/core/SmileApp.vue'"
23+
)
24+
return { code: updatedSrc }
25+
} else if (config.mode == 'presentation') {
26+
const updatedSrc = src.replace(
27+
/import App from '@\/core\/MainApp\.vue'/g,
28+
"import App from '@/dev/presentation_mode/PresentationModeApp.vue'"
2329
)
2430
return { code: updatedSrc }
2531
}

src/core/MainApp.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ const effectiveDeviceHeight = computed(() => {
135135
* - Returns true otherwise
136136
*/
137137
const showStatusBar = computed(() => {
138-
return api.currentRouteName() !== 'recruit' && api.config.mode != 'presentation'
138+
return api.currentRouteName() !== 'recruit' && api.currentRouteName() !== 'presentation_home'
139139
})
140140
141141
// Pure computed property without side effects

src/core/SmileApp.vue

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@
55
66
import { ref, computed, onMounted } from 'vue'
77
8+
/**
9+
* Import toast notification components and styles
10+
* @requires Toaster Toast notification component from sonner UI library
11+
* @requires vue-sonner/style.css Required styles for vue-sonner v2 toast notifications
12+
*/
813
import { Toaster } from '@/uikit/components/ui/sonner'
914
import 'vue-sonner/style.css' // vue-sonner v2 requires this import
1015
11-
import DevAppSidebar from '@/dev/DevAppSidebar.vue'
16+
import SmileAppSidebar from '@/core/SmileAppSidebar.vue'
1217
import { SidebarInset, SidebarProvider } from '@/uikit/components/ui/sidebar'
1318
/**
1419
* Developer mode components for debugging and development tools
@@ -21,12 +26,6 @@ import DeveloperNavBar from '@/dev/developer_mode/DeveloperNavBar.vue'
2126
import DevConsoleBar from '@/dev/developer_mode/DevConsoleBar.vue'
2227
import DevSideBar from '@/dev/developer_mode/DevSideBar.vue'
2328
24-
/**
25-
* Presentation mode components
26-
* @requires PresentationNavBar Navigation bar for presentation mode
27-
*/
28-
import PresentationNavBar from '@/dev/presentation_mode/PresentationNavBar.vue'
29-
import PresentationModeView from '@/dev/presentation_mode/PresentationModeView.vue'
3029
/**
3130
* Built-in experiment components
3231
* @requires ResponsiveDeviceContainer Responsive device container component
@@ -134,6 +133,11 @@ function onIframeLoad() {
134133
}
135134
}
136135
136+
/**
137+
* Initialize dashboard URL when component is mounted
138+
* Calls initializeDashboardUrl() to set up the initial dashboard URL
139+
* from localStorage or default value
140+
*/
137141
onMounted(() => {
138142
initializeDashboardUrl()
139143
})
@@ -146,8 +150,10 @@ onMounted(() => {
146150
'--sidebar-width': '48px',
147151
}"
148152
>
149-
<DevAppSidebar />
153+
<!-- Sidebar for developer tools -->
154+
<SmileAppSidebar />
150155
<SidebarInset>
156+
<!-- Main app container for developer mode -->
151157
<div class="app-container">
152158
<!-- Analyze Mode - Clean full-screen dashboard -->
153159
<div v-if="api.store.dev.mainView === 'dashboard'" class="analyze-container">
@@ -181,19 +187,6 @@ onMounted(() => {
181187
></iframe>
182188
</div>
183189
184-
<!-- Presentation Mode - Clean full-screen presentation -->
185-
<template v-else-if="api.store.dev.mainView === 'presentation'">
186-
<!-- Top toolbar -->
187-
<div class="toolbar">
188-
<PresentationNavBar />
189-
</div>
190-
191-
<!-- Middle row - content and sidebar -->
192-
<div class="presentation-content-wrapper">
193-
<PresentationModeView />
194-
</div>
195-
</template>
196-
197190
<!-- Developer Mode - Full interface with toolbar, sidebar, console -->
198191
<template v-else>
199192
<!-- Top toolbar -->
@@ -202,7 +195,6 @@ onMounted(() => {
202195
</div>
203196
204197
<!-- Middle row - content and sidebar -->
205-
206198
<div class="content-wrapper">
207199
<div class="content-and-console">
208200
<!-- Main content - scrollable -->
@@ -357,6 +349,13 @@ onMounted(() => {
357349
overflow: hidden;
358350
}
359351
352+
.presentation-iframe {
353+
width: 100%;
354+
height: 100%;
355+
border: none;
356+
overflow: hidden;
357+
}
358+
360359
.docs-iframe {
361360
width: 100%;
362361
height: 100%;
Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,13 @@ import {
77
SidebarGroup,
88
SidebarGroupContent,
99
SidebarHeader,
10-
SidebarInput,
1110
SidebarMenu,
1211
SidebarMenuButton,
1312
SidebarMenuItem,
14-
SidebarTrigger,
15-
useSidebar,
1613
} from '@/uikit/components/ui/sidebar'
1714
1815
import { Popover, PopoverContent, PopoverTrigger } from '@/uikit/components/ui/popover'
1916
import ConfigDevPanel from '@/dev/developer_mode/ConfigDevPanel.vue'
20-
import Toggle from '@/uikit/components/ui/toggle/Toggle.vue'
2117
import { Sun, Moon } from 'lucide-vue-next'
2218
import { useColorMode } from '@vueuse/core'
2319
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/uikit/components/ui/tooltip'
@@ -99,20 +95,6 @@ const isDarkMode = computed({
9995
</SidebarMenuItem>
10096
-->
10197

102-
<!-- Present -->
103-
<SidebarMenuItem>
104-
<SidebarMenuButton
105-
class="px-[0.05rem] group-data-[collapsible=icon]:!p-1.5 my-1"
106-
:class="{
107-
'bg-chart-4 hover:!bg-chart-4/80': api.store.dev.mainView === 'presentation',
108-
'hover:!bg-sidebar-border': api.store.dev.mainView !== 'presentation',
109-
}"
110-
tooltip="Presentation Mode"
111-
@click="api.store.dev.mainView = 'presentation'"
112-
>
113-
<i-uil-presentation-line class="!size-5" />
114-
</SidebarMenuButton>
115-
</SidebarMenuItem>
11698
<!-- Recruit
11799
<SidebarMenuItem>
118100
<SidebarMenuButton
@@ -159,7 +141,7 @@ const isDarkMode = computed({
159141
</SidebarMenuButton>
160142
</TooltipTrigger>
161143
<TooltipContent side="right">
162-
<p>{{ isDarkMode ? 'Switch to Light Mode' : 'Switch to Dark Mode' }}</p>
144+
<p>{{ isDarkMode ? 'Switch to Light Mode in Dev Tools' : 'Switch to Dark Mode in Dev Tools' }}</p>
163145
</TooltipContent>
164146
</Tooltip>
165147
</TooltipProvider>

src/core/composables/useAPI.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,8 @@ export class SmileAPI {
464464
*/
465465
setAutofill(autofill) {
466466
this.logStore.debug('SMILEAPI: registering autofill function')
467-
if (this.store.config.mode === 'development') this.store.setAutofill(autofill)
467+
if (this.store.config.mode === 'development' || this.store.config.mode === 'presentation')
468+
this.store.setAutofill(autofill)
468469
}
469470

470471
/**
@@ -473,7 +474,8 @@ export class SmileAPI {
473474
*/
474475
removeAutofill() {
475476
this.logStore.debug('SMILEAPI: removing autofill')
476-
if (this.store.config.mode === 'development') this.store.removeAutofill()
477+
if (this.store.config.mode === 'development' || this.store.config.mode === 'presentation')
478+
this.store.removeAutofill()
477479
}
478480

479481
// Completion and recruitment
@@ -520,6 +522,15 @@ export class SmileAPI {
520522
return this.route.name
521523
}
522524

525+
// routes
526+
/**
527+
* Gets the info of the current route
528+
* @returns {Object} The current route info
529+
*/
530+
currentRouteInfo() {
531+
return this.route
532+
}
533+
523534
/**
524535
* Gets the name of the current view
525536
* @returns {string} The current view name

src/core/main.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@
44

55
/**
66
* Core imports for the SMILE application including:
7-
* - Vue and Vue plugins (FormKit, Router, Pinia, Google Analytics)
8-
* - UI components and styling (FontAwesome, FormKit theme)
7+
* - Vue and Vue plugins (Router, Pinia, Google Analytics)
98
* - Application configuration (timeline, icons)
109
*/
1110
import { useRouter, addGuards } from '@/core/router'
1211
import { pinia } from '@/core/stores/createPinia'
1312

1413
import timeline from '@/user/design'
15-
import App from '@/core/SmileApp.vue'
14+
15+
// this is automatically replaced with SmileApp.vue in the vite strip-devtool.js plugin for developer mode
16+
// or PresentationModeApp.vue in the presentation mode
17+
import App from '@/core/MainApp.vue'
1618
import { createApp } from 'vue'
1719
import VueGtag from 'vue-gtag'
1820
import '@/core/main.css'

src/dev/developer_mode/DeveloperNavBar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ const notificationType = ref('default')
249249
</div>
250250
251251
<!-- color mode button -->
252-
<div class="flex items-center" v-if="api.store.dev.isFullscreen">
252+
<div class="flex items-center" v-if="api.store.dev.isFullscreen && api.currentRouteName() !== 'recruit'">
253253
<ColorModeButton></ColorModeButton>
254254
</div>
255255

0 commit comments

Comments
 (0)