refactor: media cards use proper <a href> links instead of JS navigation
MediaCard, MediaRow, CollageHero, HeroSection, and MediaDetail cast cards now render as <a> tags with real hrefs. Modified clicks (ctrl+click, middle-click) navigate natively, enabling open-in-new-tab and link copying. Plain left-clicks continue through the existing showDetail flow for side-effects like focus-state saving.
This commit is contained in:
@@ -10,13 +10,14 @@
|
||||
:item="item"
|
||||
:nav-row="rowIndex"
|
||||
:nav-col="index"
|
||||
:href="getItemHref(item)"
|
||||
@click="$emit('select', item)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { MediaItem } from "../types"
|
||||
import type { MediaItem, EpisodeWithSeries } from "../types"
|
||||
import MediaCard from "./MediaCard.vue"
|
||||
|
||||
defineProps<{
|
||||
@@ -28,4 +29,12 @@ defineProps<{
|
||||
defineEmits<{
|
||||
select: [MediaItem]
|
||||
}>()
|
||||
|
||||
function getItemHref(item: MediaItem): string | undefined {
|
||||
if (item.type === "episode") {
|
||||
const epData = item.data as EpisodeWithSeries
|
||||
return `#/series/${epData.series.id}`
|
||||
}
|
||||
return `#/${item.type}/${item.id}`
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user