refactor: remove withDefaults macro and clean up reactive props destructuring (#3217)

This commit is contained in:
TAKAHASHI Shuuji 2025-03-02 23:50:12 +09:00 committed by GitHub
parent 7d9712c209
commit 60b1d0224c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 177 additions and 232 deletions

View file

@ -2,7 +2,7 @@
import type { mastodon } from 'masto'
import reservedNames from 'github-reserved-names'
const props = defineProps<{
const { card } = defineProps<{
card: mastodon.v1.PreviewCard
}>()
@ -30,7 +30,7 @@ interface Meta {
const supportedReservedRoutes = ['sponsors']
const meta = computed(() => {
const { url } = props.card
const { url } = card
const path = url.split('https://github.com/')[1]
const [firstName, secondName] = path?.split('/') || []
if (!firstName || (reservedNames.check(firstName) && !supportedReservedRoutes.includes(firstName)))
@ -42,7 +42,7 @@ const meta = computed(() => {
let type: UrlType = repo ? 'repo' : 'user'
let number: string | undefined
let details = (props.card.title ?? '').replace('GitHub - ', '').split(' · ')[0]
let details = (card.title ?? '').replace('GitHub - ', '').split(' · ')[0]
if (repo) {
const repoPath = `${user}/${repo}`
@ -63,7 +63,7 @@ const meta = computed(() => {
const avatar = `https://github.com/${user}.png?size=256`
const author = props.card.authorName
const author = card.authorName
return {
type,
user,