From c7ae7d5a1c7efa62502113bf658cdd7a6456e22b Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Mon, 14 Nov 2022 22:54:30 +0800 Subject: [PATCH] feat: status details --- README.md | 81 +------------------------- app.vue | 1 + components/status/StatusActions.vue | 4 +- components/status/StatusAttachment.vue | 2 +- components/status/StatusBody.vue | 2 +- components/status/StatusCard.vue | 55 +++++++++++++---- components/status/StatusDetails.vue | 33 +++++++++++ components/timeline/TimelineList.vue | 2 +- layouts/default.vue | 15 +++-- pages/404.vue | 17 ------ pages/@[user]/[post].vue | 13 +++-- pages/index.vue | 11 ++-- pages/login.vue | 23 ++++++++ pages/public.vue | 8 +++ plugins/masto.ts | 7 ++- styles/vars.css | 1 + unocss.config.ts | 1 + 17 files changed, 151 insertions(+), 125 deletions(-) create mode 100644 components/status/StatusDetails.vue delete mode 100644 pages/404.vue create mode 100644 pages/login.vue create mode 100644 pages/public.vue diff --git a/README.md b/README.md index ade0e9ac..f7d00e5c 100644 --- a/README.md +++ b/README.md @@ -1,80 +1,5 @@ -

- -

+# Nuxtodon -

-Vitesse for Nuxt 3 -


+A Mastodon web client powered by Nuxt. -
-๐Ÿงช Working in Progress
-
- -

-
-๐Ÿ–ฅ Online Preview -

- -

- -## Features - -- [๐Ÿ’š Nuxt 3](https://v3.nuxtjs.org) - SSR, ESR, File-based routing, components auto importing, modules, etc. - -- โšก๏ธ Vite - Instant HMR - -- ๐ŸŽจ [UnoCSS](https://github.com/antfu/unocss) - The instant on-demand atomic CSS engine. - -- ๐Ÿ˜ƒ Use icons from any icon sets in Pure CSS, powered by [UnoCSS](https://github.com/antfu/unocss) - -- ๐Ÿ”ฅ The ` diff --git a/components/status/StatusDetails.vue b/components/status/StatusDetails.vue new file mode 100644 index 00000000..d4e5d193 --- /dev/null +++ b/components/status/StatusDetails.vue @@ -0,0 +1,33 @@ + + + diff --git a/components/timeline/TimelineList.vue b/components/timeline/TimelineList.vue index 4f342a5e..fed78035 100644 --- a/components/timeline/TimelineList.vue +++ b/components/timeline/TimelineList.vue @@ -8,6 +8,6 @@ defineProps<{ diff --git a/layouts/default.vue b/layouts/default.vue index ad865d64..670be664 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -1,6 +1,13 @@ diff --git a/pages/404.vue b/pages/404.vue deleted file mode 100644 index 5ee66af8..00000000 --- a/pages/404.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - diff --git a/pages/@[user]/[post].vue b/pages/@[user]/[post].vue index 96fe153a..9401c0aa 100644 --- a/pages/@[user]/[post].vue +++ b/pages/@[user]/[post].vue @@ -4,13 +4,18 @@ const props = defineProps<{ }>() const params = useRoute().params +const id = computed(() => params.post as string) const masto = await useMasto() -const { data: status } = await useAsyncData(() => masto.statuses.fetch(params.post as string)) +const { data: status } = await useAsyncData(`${id}-status`, () => masto.statuses.fetch(params.post as string)) +const { data: context } = await useAsyncData(`${id}-context`, () => masto.statuses.fetchContext(params.post as string)) diff --git a/pages/index.vue b/pages/index.vue index 663fa4f5..0881ab82 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1,10 +1,13 @@ diff --git a/pages/login.vue b/pages/login.vue new file mode 100644 index 00000000..ce6affb4 --- /dev/null +++ b/pages/login.vue @@ -0,0 +1,23 @@ + + + diff --git a/pages/public.vue b/pages/public.vue new file mode 100644 index 00000000..6a4a324f --- /dev/null +++ b/pages/public.vue @@ -0,0 +1,8 @@ + + + diff --git a/plugins/masto.ts b/plugins/masto.ts index 37203d15..5877181c 100644 --- a/plugins/masto.ts +++ b/plugins/masto.ts @@ -1,8 +1,13 @@ import { login } from 'masto' +export const DEFAULT_SERVER = 'https://mas.to' + export default defineNuxtPlugin((nuxt) => { + const server = useCookie('nuxtodon-server') + const token = useCookie('nuxtodon-token') const masto = login({ - url: 'https://mas.to', + url: server.value || DEFAULT_SERVER, + accessToken: token.value, }) nuxt.vueApp.provide('masto', masto) }) diff --git a/styles/vars.css b/styles/vars.css index 1881c42c..bd283b60 100644 --- a/styles/vars.css +++ b/styles/vars.css @@ -1,3 +1,4 @@ :root { --color-primary: #53b3cb; + --color-border: #88888820; } diff --git a/unocss.config.ts b/unocss.config.ts index f1e9e9be..d2dfb2ce 100644 --- a/unocss.config.ts +++ b/unocss.config.ts @@ -36,6 +36,7 @@ export default defineConfig({ theme: { colors: { primary: 'var(--color-primary)', + border: 'var(--color-border)', }, }, })