From 2cc3d2ea7a7e2f606cc0e42795116ae13a00b32e Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Sat, 11 May 2024 18:34:03 -1000 Subject: [PATCH] feat: :sparkles: Polish UI, add new functionality to composer --- components/composer/button.vue | 18 +++++++++++++++ components/composer/composer.vue | 37 +++++++++++++++++++++++++++--- components/sidebars/navigation.vue | 8 +++++-- composables/Config.ts | 15 ++++++++++++ layouts/app.vue | 4 +++- 5 files changed, 76 insertions(+), 6 deletions(-) create mode 100644 components/composer/button.vue diff --git a/components/composer/button.vue b/components/composer/button.vue new file mode 100644 index 0000000..1481d46 --- /dev/null +++ b/components/composer/button.vue @@ -0,0 +1,18 @@ + + + \ No newline at end of file diff --git a/components/composer/composer.vue b/components/composer/composer.vue index d0e508e..03d4ea2 100644 --- a/components/composer/composer.vue +++ b/components/composer/composer.vue @@ -14,14 +14,37 @@ -
{{ remainingCharacters }}
+ +
+ +
+ + + + + + + + + + + + Send! @@ -38,10 +61,18 @@ const textarea = ref(undefined); const { input: content } = useTextareaAutosize({ element: textarea, }); -const { Control_Enter, Command_Enter } = useMagicKeys(); +const { Control_Enter, Command_Enter, Control_Alt } = useMagicKeys(); const respondingTo = ref(null); const respondingType = ref<"reply" | "quote" | null>(null); const me = useMe(); +const cw = ref(null as string | null); +const markdown = ref(true); + +const splashes = useConfig().COMPOSER_SPLASHES; +const chosenSplash = ref(splashes[Math.floor(Math.random() * splashes.length)]); +watch(Control_Alt, () => { + chosenSplash.value = splashes[Math.floor(Math.random() * splashes.length)]; +}); onMounted(() => { useListen("composer:reply", (note: Status) => { @@ -86,7 +117,7 @@ const send = async () => { }, body: JSON.stringify({ status: content.value.trim(), - content_type: "text/markdown", + content_type: markdown.value ? "text/markdown" : "text/plain", in_reply_to_id: respondingType.value === "reply" ? respondingTo.value?.id diff --git a/components/sidebars/navigation.vue b/components/sidebars/navigation.vue index 1d477be..56503a3 100644 --- a/components/sidebars/navigation.vue +++ b/components/sidebars/navigation.vue @@ -44,10 +44,14 @@

Posts

- Compose + +
@@ -210,7 +214,7 @@ const signOut = async () => { tokenData.value.access_token, tokenData.value.access_token, ) - .catch(() => {}); + .catch(() => { }); tokenData.value = null; me.value = null; diff --git a/composables/Config.ts b/composables/Config.ts index ec5d116..d8b84a7 100644 --- a/composables/Config.ts +++ b/composables/Config.ts @@ -8,5 +8,20 @@ export const useConfig = () => { link: "https://sk22.github.io/megalodon/", }, ], + COMPOSER_SPLASHES: [ + "What's on your mind?", + "What's happening?", + "Meow meow meow meow meow", + "Just arrived at Luna Nova Academy", + "I'm a little teapot, short and stout", + "Hey, you. You're finally awake. You were trying to cross the border, right?", + "Aren't you a little short for a stormtrooper?", + "I'm a leaf on the wind. Watch how I soar.", + "I am Groot.", + "Hello everybody, my name is Markiplier", + "I'm Commander Shepard, and this is my favorite website on the Citadel", + "I'm sorry, Dave. I'm afraid I can't do that.", + "I am the Senate", + ], }; }; diff --git a/layouts/app.vue b/layouts/app.vue index 589ab5d..7209579 100644 --- a/layouts/app.vue +++ b/layouts/app.vue @@ -68,8 +68,10 @@ useServerSeoMeta({ const { n } = useMagicKeys(); -watchEffect(() => { +watchEffect(async () => { if (n.value) { + // Wait 50ms + await new Promise((resolve) => setTimeout(resolve, 50)); useEvent("composer:open"); } });