forked from BRETT/BRETT
Keep thread navigation within the originating upload list
Record where an upload was opened from in a new useUploadNavContext state. When a tile is clicked on a user profile, the thread page passes that context to the upload detail API, which scopes the newer/older neighbors to that user's uploads. Arrow clicks reseed the context for the next thread, so the chain stays within the source list without a URL parameter. Threads opened directly (notification, reload) fall back to the global order. The breadcrumb reads the same context and shows the profile path for profile-originated threads, now including the thread id in the final crumb. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -37,8 +37,13 @@ const canPlaceholder = computed(() => {
|
||||
|
||||
const indicator = useLoadingIndicator()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const navigating = ref(false)
|
||||
|
||||
// Herkunft im State merken (kein URL-Param): /user/<id> scopt Thread-Pfeile
|
||||
// und Breadcrumbs auf die Uploads dieses Nutzers
|
||||
const navContext = useUploadNavContext()
|
||||
|
||||
const spanClass = computed(() => {
|
||||
if (uniform.value) return ''
|
||||
const count = props.upload.commentCount ?? 0
|
||||
@@ -81,6 +86,11 @@ async function openUpload(e: MouseEvent) {
|
||||
url: props.upload.url,
|
||||
thumbUrl: props.upload.thumbUrl ?? null,
|
||||
}
|
||||
navContext.value = {
|
||||
uploadId: props.upload.id,
|
||||
fromPath: /^\/user\/\d+$/.test(route.path) ? route.path : null,
|
||||
fromLabel: props.upload.userName ?? null,
|
||||
}
|
||||
|
||||
try {
|
||||
const threadFetch = $fetch(`/api/uploads/${props.upload.id}`)
|
||||
|
||||
Reference in New Issue
Block a user