Skip to content

Commit

Permalink
Fix link to terms & conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmyersdev committed Oct 3, 2023
1 parent aae5064 commit 344717c
Showing 1 changed file with 120 additions and 118 deletions.
238 changes: 120 additions & 118 deletions pages/menu.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,113 @@
<script>
import { UserCircleIcon as AccountIcon, BeakerIcon, CheckIcon, ChevronUpDownIcon, DocumentIcon, DocumentTextIcon, InboxIcon, CloudArrowUpIcon as SaveIcon, MagnifyingGlassIcon as SearchIcon, Cog8ToothIcon as SettingsIcon, HashtagIcon as TagIcon, TrashIcon, UserCircleIcon, Square2StackIcon as WorkspaceIcon, Squares2X2Icon as WorkspacesIcon } from '@heroicons/vue/24/outline'
import { nanoid } from 'nanoid'
import { inject } from 'vue'
import CoreButton from '#root/components/CoreButton.vue'
import CoreDivider from '#root/components/CoreDivider.vue'
import CoreLink from '#root/components/CoreLink.vue'
import Key from '#root/components/Key.vue'
import ModK from '#root/components/ModK.vue'
import ModKKey from '#root/components/ModKKey.vue'
import TagLink from '#root/components/TagLink.vue'
import TheLogo from '#root/components/TheLogo.vue'
import { DEACTIVATE_CONTEXT, SET_CONTEXT_TAGS } from '#root/src/store/actions'
import { useFiles } from '#root/src/stores/useFiles'
import { AsyncIterable } from '#root/src/utils/iterables'
export default {
components: {
AccountIcon,
BeakerIcon,
CheckIcon,
ChevronUpDownIcon,
CoreButton,
CoreDivider,
CoreLink,
DocumentIcon,
DocumentTextIcon,
TagIcon,
InboxIcon,
Key,
ModK,
ModKKey,
SaveIcon,
SearchIcon,
SettingsIcon,
TagLink,
TheLogo,
TrashIcon,
UserCircleIcon,
WorkspaceIcon,
WorkspacesIcon,
},
inject: ['mq'],
setup() {
const user = inject('user')
const { public: { fathomEventCtaSaveDocs, firebaseDisabled } } = useConfig()
const trackCta = () => {
window.fathom.trackGoal(fathomEventCtaSaveDocs, 0)
}
return {
firebaseDisabled,
trackCta,
user,
}
},
computed: {
authIsEvaluated() {
return this.$store.state.auth.isEvaluated
},
context() {
return this.$store.state.context
},
contextTags() {
return this.context.tags.sort()
},
contexts() {
return this.$store.getters.sortedContexts
},
experimentalFeaturesEnabled() {
return this.$store.state.settings.experimental
},
mediumPlus() {
return ['md', 'lg', 'xl', 'xxl'].includes(this.mq.current)
},
tags() {
return this.$store.getters.tags
},
},
methods: {
clearContext() {
this.$store.dispatch(DEACTIVATE_CONTEXT)
},
async openFile() {
const id = nanoid()
const [handle] = await window.showOpenFilePicker({ types: [{ description: 'Markdown Files', accept: { 'text/markdown': ['.markdown', '.md'] } }] })
try {
const { id } = await AsyncIterable(useFiles().files).any((file) => {
return file.handle.isSameEntry(handle)
})
if (id) {
return this.$router.push({ path: `/file-editor/${id}` })
}
} catch {}
await handle.createWritable()
useFiles().add({ id, handle })
return this.$router.push({ path: `/file-editor/${id}` })
},
setContext(context) {
this.$store.dispatch(SET_CONTEXT_TAGS, { context })
},
},
}
</script>

<template>
<CoreScrollable class="p-4 md:p-2">
<div class="flex flex-col flex-grow pb-3">
Expand Down Expand Up @@ -35,15 +145,15 @@
</div>
</CoreLink>
<div v-if="experimentalFeaturesEnabled">
<button @click="openFile" class="sidebar-link w-full" title="Experimental">
<button class="sidebar-link w-full" title="Experimental" @click="openFile">
<DocumentIcon class="w-5" />
<span class="action flex flex-grow items-center justify-between ml-3">
<span>Open File</span>
<BeakerIcon class="text-gray-300 dark:text-gray-700 w-5" />
</span>
</button>
</div>
<CoreLink v-if="!firebaseDisabled && !user.id" @click="trackCta" :to="{ path: '/account' }" class="sidebar-link text-theme">
<CoreLink v-if="!firebaseDisabled && !user.id" :to="{ path: '/account' }" class="sidebar-link text-theme" @click="trackCta">
<SaveIcon class="w-5" />
<span class="action flex flex-grow items-stretch justify-between ml-3">
<span>Save Docs</span>
Expand Down Expand Up @@ -78,22 +188,24 @@
<CoreDivider />
<h6 class="px-1 pt-2 sidebar-label cursor-pointer">
<span class="flex items-center gap-2"><ChevronUpDownIcon class="h-4" /> Workspace</span>
<button @click="clearContext" class="button button-color-surface">
<button class="button button-color-surface" @click="clearContext">
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</h6>
<div v-if="contextTags.length" class="flex flex-col gap-2 md:gap-1">
<TagLink v-for="tag in contextTags" :key="tag" :tag="tag" class="context-tag"></TagLink>
<TagLink v-for="tag in contextTags" :key="tag" :tag="tag" class="context-tag" />
</div>
<div v-else class="p-6 md:p-2">
No Tags Selected
</div>
<div v-else class="p-6 md:p-2">No Tags Selected</div>
</div>
<CoreDivider v-if="contexts.length" />
<h6 v-if="contexts.length" class="px-1 pt-2 sidebar-label cursor-pointer">
<span class="flex items-center gap-2"><ChevronUpDownIcon class="h-4" /> Workspaces</span>
</h6>
<button v-for="context in contexts" :key="context.id" @click="setContext(context)" class="sidebar-link w-full">
<button v-for="context in contexts" :key="context.id" class="sidebar-link w-full" @click="setContext(context)">
<WorkspaceIcon class="w-5" />
<span class="action flex flex-grow items-stretch justify-between ml-3">
<span>{{ context.name }}</span>
Expand All @@ -108,7 +220,7 @@
<span class="ml-3 flex-grow">Tags</span>
</CoreLink>
<div v-if="mediumPlus">
<TagLink v-for="tag in tags" :key="tag" :tag="tag" class="sidebar-link"></TagLink>
<TagLink v-for="tag in tags" :key="tag" :tag="tag" class="sidebar-link" />
</div>
<CoreDivider />
<h6 class="px-1 pt-2 sidebar-label cursor-pointer">
Expand All @@ -120,7 +232,7 @@
<span>Privacy Policy</span>
</span>
</CoreLink>
<CoreLink :to="{ path: 'terms-and-conditions' }" class="sidebar-link">
<CoreLink :to="{ path: '/terms-and-conditions' }" class="sidebar-link">
<DocumentTextIcon class="w-5" />
<span class="action flex flex-grow items-stretch justify-between ml-3">
<span>Terms &amp; Conditions</span>
Expand All @@ -130,113 +242,3 @@
</div>
</CoreScrollable>
</template>

<script>
import { UserCircleIcon as AccountIcon, BeakerIcon, CheckIcon, ChevronUpDownIcon, DocumentIcon, DocumentTextIcon, InboxIcon, CloudArrowUpIcon as SaveIcon, MagnifyingGlassIcon as SearchIcon, Cog8ToothIcon as SettingsIcon, HashtagIcon as TagIcon, Square2StackIcon as WorkspaceIcon, Squares2X2Icon as WorkspacesIcon, TrashIcon, UserCircleIcon } from '@heroicons/vue/24/outline'
import { nanoid } from 'nanoid'
import { inject } from 'vue'
import CoreButton from '#root/components/CoreButton.vue'
import CoreDivider from '#root/components/CoreDivider.vue'
import CoreLink from '#root/components/CoreLink.vue'
import Key from '#root/components/Key.vue'
import ModK from '#root/components/ModK.vue'
import ModKKey from '#root/components/ModKKey.vue'
import TagLink from '#root/components/TagLink.vue'
import TheLogo from '#root/components/TheLogo.vue'
import { DEACTIVATE_CONTEXT, SET_CONTEXT_TAGS } from '#root/src/store/actions'
import { useFiles } from '#root/src/stores/useFiles'
import { AsyncIterable } from '#root/src/utils/iterables'
export default {
components: {
AccountIcon,
BeakerIcon,
CheckIcon,
ChevronUpDownIcon,
CoreButton,
CoreDivider,
CoreLink,
DocumentIcon,
DocumentTextIcon,
TagIcon,
InboxIcon,
Key,
ModK,
ModKKey,
SaveIcon,
SearchIcon,
SettingsIcon,
TagLink,
TheLogo,
TrashIcon,
UserCircleIcon,
WorkspaceIcon,
WorkspacesIcon,
},
inject: ['mq'],
computed: {
authIsEvaluated() {
return this.$store.state.auth.isEvaluated
},
context() {
return this.$store.state.context
},
contextTags() {
return this.context.tags.sort()
},
contexts() {
return this.$store.getters.sortedContexts
},
experimentalFeaturesEnabled() {
return this.$store.state.settings.experimental
},
mediumPlus() {
return ['md', 'lg', 'xl', 'xxl'].includes(this.mq.current)
},
tags() {
return this.$store.getters.tags
},
},
methods: {
clearContext() {
this.$store.dispatch(DEACTIVATE_CONTEXT)
},
async openFile() {
const id = nanoid()
const [handle] = await window.showOpenFilePicker({ types: [{ description: 'Markdown Files', accept: { 'text/markdown': ['.markdown', '.md'] } }] })
try {
const { id } = await AsyncIterable(useFiles().files).any((file) => {
return file.handle.isSameEntry(handle)
})
if (id) {
return this.$router.push({ path: `/file-editor/${id}` })
}
} catch {}
await handle.createWritable()
useFiles().add({ id, handle })
return this.$router.push({ path: `/file-editor/${id}` })
},
setContext(context) {
this.$store.dispatch(SET_CONTEXT_TAGS, { context })
},
},
setup() {
const user = inject('user')
const { public: { fathomEventCtaSaveDocs, firebaseDisabled } } = useConfig()
const trackCta = () => {
window.fathom.trackGoal(fathomEventCtaSaveDocs, 0)
}
return {
firebaseDisabled,
trackCta,
user,
}
},
}
</script>

0 comments on commit 344717c

Please sign in to comment.