-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite PostRepliesList component in TS
- Loading branch information
Showing
4 changed files
with
51 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<template> | ||
<ul :class="$style.root"> | ||
Mentions: | ||
<li v-for="reply of processedReplies" :key="reply.href"> | ||
<RouterLink :to="reply.href">{{ reply.label }}</RouterLink> | ||
</li> | ||
</ul> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed } from "vue" | ||
import { firstFromStringArrayOrString } from "@/utils" | ||
import { useRoute } from "vue-router" | ||
import type { Post } from "@/store" | ||
const props = defineProps<{ replies: Post["replies"] }>() | ||
const route = useRoute() | ||
const processedReplies = computed(() => { | ||
const currentBoardName = firstFromStringArrayOrString(route.params.boardName) | ||
return props.replies.map(({ boardName, threadId, number }) => ({ | ||
href: `/${boardName}/${threadId}`, | ||
label: boardName === currentBoardName | ||
? `#${number}` | ||
: `#/${boardName}/${number}` | ||
})) | ||
}) | ||
</script> | ||
|
||
<style module> | ||
.root { | ||
display: flex; | ||
font-size: 0.85em; | ||
gap: 0.5em; | ||
list-style: none; | ||
margin: 1em 0 0 0; | ||
padding: 0; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export { default as ModalShell } from "./ModalShell.vue" | ||
export { default as PostAttachment } from "./PostAttachment.vue" | ||
export { default as PostMenu } from "./PostMenu.vue" | ||
export { default as ToggleSwitch } from "./ToggleSwitch.vue" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters