Skip to content

Commit e8a747e

Browse files
Prepare to deploy new UI (#304)
2 parents 19d9d68 + 4abfedb commit e8a747e

24 files changed

+2533
-2001
lines changed

app.vue

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,24 @@ export default defineComponent({
1111
setup() {
1212
const { public: { appName, appTitle } } = useConfig()
1313
const mq = useMq()
14+
const router = useRouter()
1415
const { store } = useVuex()
1516
1617
const isMounted = ref(false)
1718
19+
const flow = computed(() => {
20+
// A param to indicate a user flow (e.g. completing sign-up or sign-in).
21+
return router.currentRoute.value.query.flow
22+
})
23+
24+
const showChangeLog = computed(() => {
25+
return router.currentRoute.value.path === '/docs/new' && !router.currentRoute.value.query.ci
26+
})
27+
28+
const ligatures = computed(() => {
29+
return store.state.settings.editor.ligatures
30+
})
31+
1832
onMounted(async () => {
1933
isMounted.value = true
2034
@@ -50,21 +64,12 @@ export default defineComponent({
5064
})
5165
5266
return {
67+
flow,
68+
ligatures,
69+
showChangeLog,
5370
sizes,
5471
}
5572
},
56-
computed: {
57-
flow() {
58-
// A param to indicate a user flow (e.g. completing sign-up or sign-in).
59-
return this.$route.query.flow
60-
},
61-
showChangeLog() {
62-
return this.$route.path === '/docs/new' && !this.$route.query.ci
63-
},
64-
ligatures() {
65-
return this.$store.state.settings.editor.ligatures
66-
},
67-
},
6873
})
6974
</script>
7075

assets/css/tailwind.css

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
--colors-primary: 59 130 246;
1212
}
1313

14-
.dark {
14+
.dark,
15+
[data-appearance=dark] {
1516
--layer-0-bg: 18 18 18;
1617
--layer-0-bg-hover: 39 39 42;
1718
--layer-0-bg-active: 39 39 42;
@@ -80,12 +81,14 @@
8081
}
8182

8283
@media (prefers-color-scheme: dark) {
83-
.auto {
84+
.auto,
85+
[data-appearance=auto] {
8486
@apply dark;
8587
}
8688
}
8789

88-
.light {
90+
.light,
91+
[data-appearance=light] {
8992
--layer-0-bg: 244 244 245;
9093
--layer-0-bg-hover: 228 228 231;
9194
--layer-0-bg-active: 228 228 231;
@@ -154,12 +157,14 @@
154157
}
155158

156159
@media (prefers-color-scheme: light) {
157-
.auto {
160+
.auto,
161+
[data-appearance=auto] {
158162
@apply light;
159163
}
160164
}
161165

162-
.custom {
166+
.custom,
167+
[data-appearance=custom] {
163168
--layer-0-bg: 10 0 31;
164169
--layer-0-bg-hover: 21 0 44;
165170
--layer-0-bg-active: 32 2 58;

components/ChangeLog.vue

Lines changed: 44 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,78 @@
11
<script lang="ts" setup>
2-
import { onMounted, ref } from 'vue'
3-
import ChangeLogEntry from '#root/components/ChangeLogEntry.vue'
4-
import CoreLink from '~/components/CoreLink.vue'
2+
import { ref } from 'vue'
3+
import KeyboardKey from './KeyboardKey.vue'
4+
import KeyboardKeyCombination from './KeyboardKeyCombination.vue'
5+
import ChangeLogEntry from './ChangeLogEntry.vue'
6+
import CoreLink from './CoreLink.vue'
7+
import Modal from './Modal.vue'
8+
import { track } from '/helpers/analytics'
59
6-
// import Code from '#root/components/Code.vue'
7-
import Modal from '#root/components/Modal.vue'
8-
import { track } from '#helpers/analytics'
10+
// When updating the changelog, generate a new timestamp
11+
// with `Date.now()`.
12+
const lastUpdated = ref(1726035870403)
13+
const lastSeen = useLocalStorage('changelog:v1', 0, {
14+
initOnMounted: true,
15+
})
916
17+
const showChangeLog = ref(false)
18+
const { modKey } = useDevice()
1019
const { public: { fathomEventCtaModalUpgrade, linkFeedback } } = useConfig()
1120
const { isSubscribed, user } = useSubscription()
1221
13-
const showChangeLog = ref(false)
1422
const closeChangeLog = () => {
1523
showChangeLog.value = false
1624
}
25+
1726
const trackCta = () => {
1827
closeChangeLog()
1928
track(fathomEventCtaModalUpgrade)
2029
}
2130
22-
onMounted(async () => {
23-
try {
24-
// Make sure this timestamp is updated when new entries are added.
25-
// (new Date()).toISOString()
26-
const lastEntryTimestamp = '2023-10-07T18:41:43.227Z'
27-
const lastClientTimestamp = localStorage.getItem('changelog:v1')
28-
29-
if (!lastClientTimestamp || new Date(lastEntryTimestamp) > new Date(lastClientTimestamp)) {
30-
// showChangeLog.value = true
31+
watch(lastSeen, () => {
32+
if (typeof lastSeen.value === 'string') {
33+
lastSeen.value = Date.parse(lastSeen.value)
34+
}
3135
32-
localStorage.setItem('changelog:v1', lastEntryTimestamp)
36+
if (lastSeen.value) {
37+
if (lastSeen.value < lastUpdated.value) {
38+
showChangeLog.value = true
3339
}
34-
} catch (error) {
35-
console.warn({ error })
3640
}
41+
42+
lastSeen.value = lastUpdated.value
3743
})
3844
</script>
3945

4046
<template>
4147
<Modal v-if="showChangeLog" @close="closeChangeLog">
4248
<template #header>
43-
What's new?
49+
<span class="inline-flex items-center gap-2"><Icon name="Announce" size="1em" /> Announcements</span>
4450
</template>
45-
<div class="flex flex-col gap-12">
46-
<ChangeLogEntry header="Saturday, October 7th, 2023">
47-
<p><strong>We would love your feedback!</strong></p>
48-
<template #items>
51+
<div class="flex flex-col gap-4">
52+
<ChangeLogEntry>
53+
<template #header>
54+
A fresh new look
55+
</template>
56+
<template #timestamp>
57+
Tuesday, September 10th, 2024
58+
</template>
59+
<p>The UI has been redesigned to better prepare for future improvements.</p>
60+
<ul class="flex flex-col gap-1 list-disc pl-6">
4961
<li>
50-
We have created <CoreLink :to="linkFeedback" class="text-blue-500">
51-
a feedback board
52-
</CoreLink> to make it easier for you to share your ideas or feature requests with us.
62+
<strong>Tabs</strong> are now in the sidebar!
5363
</li>
5464
<li>
55-
No time right now? No problem! You can find a new <strong>Feedback</strong> link in the menu when you want to share your ideas.
65+
A new feature called "<strong>Zen Mode</strong>" has been added to help you focus on your writing or note-taking. You can toggle it with the <KeyboardKeyCombination><KeyboardKey :text="modKey" /><KeyboardKey text="\" /></KeyboardKeyCombination> shortcut or by tapping the <Icon name="Logo" class="inline" /> logo in the top nav.
5666
</li>
57-
</template>
67+
<li>
68+
Additionally, this release contains multiple bug fixes, performance enhancements, and accessibility improvements.
69+
</li>
70+
</ul>
71+
<p>Have thoughts on what we should work on next? We would <strong>love</strong> your <CoreLink :to="linkFeedback" class="text-blue-500">feedback</CoreLink>!</p>
5872
</ChangeLogEntry>
59-
<!-- Todo: Create a history view for older announcements. -->
60-
<!-- <div v-if="false" class="flex flex-col gap-12">
61-
<ChangeLogEntry header="Monday, November 14th, 2022">
62-
<p>Introducing a new way to sign in.</p>
63-
<template #items>
64-
<li>Send yourself a <strong>magic link</strong> to sign in with your email address.</li>
65-
<li>If you already have an account with a social provider, your email address will be linked to that account.</li>
66-
</template>
67-
</ChangeLogEntry>
68-
<ChangeLogEntry header="Sunday, October 16th, 2022">
69-
<p>Today's updates focus on <strong>portability</strong>.</p><p>Vendor lock-in has become commonplace, but you deserve the right to take your data with you <strong>anywhere</strong> you choose. Thanks to recent community contributions, transferring your data into or out of Octo has become much simpler.</p>
70-
<template #items>
71-
<li>Import plain-text Markdown files into your knowledge base, directly from App Settings.</li>
72-
<li>Export your entire knowledge base as a zipped folder of plain-text Markdown files, directly from App Settings.</li>
73-
</template>
74-
</ChangeLogEntry>
75-
<ChangeLogEntry header="Thursday, July 21st, 2022">
76-
<template #items>
77-
<li>Tags are now properly highlighted and support a wide array of unicode letters and marks. Additionally, when typing a new tag, suggestions will appear based on your existing tags. Press enter to use the active tag suggestion.</li>
78-
<li>Direct doc references are finally here! Start typing the top-level title of another doc with the <CoreCode>[[my other doc]]</CoreCode> syntax for suggestions to appear.</li>
79-
</template>
80-
</ChangeLogEntry>
81-
<ChangeLogEntry header="Monday, May 23rd, 2022">
82-
<template #items>
83-
<li>The Formatting Toolbar is here! You can toggle it per-device in App Settings.</li>
84-
<li>You can now improve the readability of active docs by customizing the max-width to better fit your needs (defaults to 100 characters).</li>
85-
<li>There is a new 'Auto' appearance option that will match your system theme. It is the default for new users, and you can update it for yourself in App Settings.</li>
86-
<li>Formatting tokens (<CoreCode>#</CoreCode>, <CoreCode>*</CoreCode>, etc) now have better contrast with the surrounding text.</li>
87-
<li>Additionally, this release includes dependency updates, performance improvements, and small bugfixes.</li>
88-
</template>
89-
</ChangeLogEntry>
90-
<ChangeLogEntry header="Wednesday, March 30th, 2022">
91-
<template #items>
92-
<li>Drag-and-drop or paste files to upload and attach to the current doc (Octo Pro).</li>
93-
</template>
94-
</ChangeLogEntry>
95-
<ChangeLogEntry header="Saturday, March 26th, 2022">
96-
<template #items>
97-
<li>Changelog notifications are displayed when Octo updates.</li>
98-
<li>Improvements have been made to IME language support.</li>
99-
<li>Regular expressions are automatically recognized by the <CoreCode>/.*/i</CoreCode> syntax in searches.</li>
100-
<li>The Active Context bar has been merged into the navigation menu.</li>
101-
<li>The legacy Markdown editor has been removed in favor of Ink.</li>
102-
<li>The Daily Notepad page now works offline.</li>
103-
<li>Vim Mode can be enabled on the Settings page.</li>
104-
</template>
105-
</ChangeLogEntry>
106-
</div> -->
10773
</div>
10874
<template #footer>
109-
<div class="flex items-center justify-end gap-2">
75+
<div class="flex items-center justify-end gap-1">
11076
<CoreButton @click="closeChangeLog">
11177
Dismiss
11278
</CoreButton>

components/ChangeLogEntry.vue

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
<script lang="ts" setup>
2-
const props = defineProps<{ header: string }>()
2+
defineProps<{ header?: string }>()
33
</script>
44

55
<template>
66
<div class="flex flex-col gap-4">
7-
<h2 class="text-xl">{{ props.header }}</h2>
7+
<small v-if="$slots.timestamp" class="text-layer-muted">
8+
<slot name="timestamp" />
9+
</small>
10+
<header class="flex flex-col gap-2">
11+
<h3 v-if="$slots.header || header" class="text-2xl">
12+
<strong>
13+
<slot name="header">
14+
<template v-if="header">
15+
{{ header }}
16+
</template>
17+
</slot>
18+
</strong>
19+
</h3>
20+
</header>
821
<slot />
9-
<ul v-if="$slots.items" class="flex flex-col gap-1 list-disc pl-4">
10-
<slot name="items" />
11-
</ul>
1222
</div>
1323
</template>

components/CoreCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const classes = computed(() => props.outline ? 'border border-layer' : 'bg-layer
1414
<component
1515
:is="component"
1616
:class="classes"
17-
class="p-4 rounded"
17+
class="p-2 rounded"
1818
>
1919
<slot />
2020
</component>

components/CoreEditorToolbar.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ withDefaults(defineProps<{
2020
code: true,
2121
heading: true,
2222
image: true,
23-
indent: true,
23+
indent: false,
2424
italic: true,
2525
link: true,
2626
numberList: true,
2727
taskList: true,
28-
unindent: true,
28+
unindent: false,
2929
upload: false,
3030
})
3131

components/Doc.vue

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default {
2222
allowDiscard: Boolean,
2323
},
2424
setup(props) {
25+
const { store } = useVuex()
2526
const html = computed(() => {
2627
const rawHtml = toHtml(props.text)
2728
@@ -33,23 +34,25 @@ export default {
3334
return rawHtml
3435
})
3536
37+
const updated = computed(() => {
38+
return `Updated on ${moment(props.updatedAt).format('ddd, MMM Do, YYYY [at] h:mm A')}`
39+
})
40+
41+
const discard = () => {
42+
store.dispatch(DISCARD_DOCUMENT, { id: props.id })
43+
}
44+
45+
const restore = () => {
46+
store.dispatch(RESTORE_DOCUMENT, { id: props.id })
47+
}
48+
3649
return {
50+
discard,
3751
html,
52+
restore,
53+
updated,
3854
}
3955
},
40-
computed: {
41-
updated() {
42-
return `Updated on ${moment(this.updatedAt).format('ddd, MMM Do, YYYY [at] h:mm A')}`
43-
},
44-
},
45-
methods: {
46-
discard() {
47-
this.$store.dispatch(DISCARD_DOCUMENT, { id: this.id })
48-
},
49-
restore() {
50-
this.$store.dispatch(RESTORE_DOCUMENT, { id: this.id })
51-
},
52-
},
5356
}
5457
</script>
5558

0 commit comments

Comments
 (0)