forked from BRETT/BRETT
Shorten thread route from /thread to /t
All internal links (tiles, prev/next nav, comments, notifications, breadcrumb, dropzone route check) point to /t/<id>. A global route middleware permanently redirects old /thread/<id> URLs including query string and comment anchor. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -47,7 +47,7 @@ const mergedComments = computed(() => {
|
||||
<NuxtLink
|
||||
v-for="comment in mergedComments"
|
||||
:key="comment.id"
|
||||
:to="`/thread/${comment.uploadId}#comment-${comment.id}`"
|
||||
:to="`/t/${comment.uploadId}#comment-${comment.id}`"
|
||||
class="block rounded-md border border-sidebar-border/60 bg-sidebar px-3 py-2.5 text-sm transition-colors hover:border-sidebar-border hover:bg-sidebar-accent"
|
||||
>
|
||||
<div class="flex items-center gap-2 text-xs text-muted-foreground">
|
||||
|
||||
@@ -11,7 +11,7 @@ const uploading = ref(false)
|
||||
|
||||
// In Threads gilt die Zone nur für die obere Bildschirmhälfte —
|
||||
// die untere Hälfte gehört den Kommentaren (dort Anhänge, sonst nichts)
|
||||
const topHalfOnly = computed(() => route.path.startsWith('/thread/'))
|
||||
const topHalfOnly = computed(() => route.path.startsWith('/t/'))
|
||||
const pointerY = ref(0)
|
||||
const inTopHalf = computed(() => !topHalfOnly.value || pointerY.value < (import.meta.client ? window.innerHeight : 0) / 2)
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ const timeAgo = useTimeAgo()
|
||||
async function goTo(n: AppNotification) {
|
||||
open.value = false
|
||||
await markRead(n.id)
|
||||
await navigateTo(`/thread/${n.uploadId}#comment-${n.commentId}`)
|
||||
await navigateTo(`/t/${n.uploadId}#comment-${n.commentId}`)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ const crumbs = computed<Crumb[]>(() => {
|
||||
const list: Crumb[] = [{ label: t('palette.home'), to: '/' }]
|
||||
const p = route.path
|
||||
if (p === '/') return []
|
||||
if (p.startsWith('/thread/')) list.push({ label: t('nav.thread') })
|
||||
if (p.startsWith('/t/')) list.push({ label: t('nav.thread') })
|
||||
else if (p === '/users') list.push({ label: t('nav.users') })
|
||||
else if (p.startsWith('/user/')) {
|
||||
list.push({ label: t('nav.users'), to: '/users' }, { label: t('nav.profile') })
|
||||
|
||||
@@ -120,14 +120,14 @@ async function openUpload(e: MouseEvent) {
|
||||
|
||||
// Die eigentliche Navigation macht der NuxtLink bereits beim Klick —
|
||||
// dieser Push ist nur noch Fallback und bei gleicher Route ein No-Op
|
||||
await router.push(`/thread/${props.upload.id}`)
|
||||
await router.push(`/t/${props.upload.id}`)
|
||||
navigating.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NuxtLink
|
||||
:to="`/thread/${upload.id}`"
|
||||
:to="`/t/${upload.id}`"
|
||||
class="upload-tile group block"
|
||||
:class="[spanClass, navigating ? 'opacity-80' : '']"
|
||||
@click.capture="captureClick"
|
||||
|
||||
Reference in New Issue
Block a user