Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix and link from related games #1045

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions frontend/src/components/Details/RelatedGames.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<script setup lang="ts">
import RelatedCard from "@/components/common/Game/Card/Related.vue";
import type { DetailedRom } from "@/stores/roms";
import { ref } from "vue";
import { computed } from "vue";

const props = defineProps<{ rom: DetailedRom }>();
const combined = ref([
const games = computed(() => [
...(props.rom.igdb_metadata?.remakes ?? []),
...(props.rom.igdb_metadata?.remasters ?? []),
...(props.rom.igdb_metadata?.expanded_games ?? []),
]);
</script>
<template>
<v-row no-gutters>
<v-col cols="4" sm="3" md="6" v-for="rom in combined">
<related-card :rom="rom" />
<v-col cols="4" sm="3" md="6" v-for="game in games">
<related-card :game="game" />
</v-col>
</v-row>
</template>
25 changes: 15 additions & 10 deletions frontend/src/components/common/Game/Card/Related.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,35 @@ import { useTheme } from "vuetify";

// Props
const props = defineProps<{
rom: IGDBRelatedGame;
game: IGDBRelatedGame;
}>();
const emit = defineEmits(["click"]);
const handleClick = (event: MouseEvent) => {
emit("click", { event: event, rom: props.rom });
};
const theme = useTheme();
const handleClick = () => {
if (props.game.slug) {
window.open(
`https://www.igdb.com/games/${props.game.slug}`,
"_blank",
"noopener noreferrer"
);
}
};
</script>

<template>
<v-card class="ma-1">
<v-card class="ma-1" v-on:click="handleClick">
<v-tooltip
activator="parent"
location="top"
class="tooltip"
transition="fade-transition"
open-delay="1000"
>{{ rom.name }}</v-tooltip
>{{ game.name }}</v-tooltip
>
<v-img
v-bind="props"
:src="
`${rom.cover_url}`
? `https:${rom.cover_url.replace('t_thumb', 't_cover_big')}`
`${game.cover_url}`
? `https:${game.cover_url.replace('t_thumb', 't_cover_big')}`
: `/assets/default/cover/big_${theme.global.name.value}_missing_cover.png`
"
:aspect-ratio="2 / 3"
Expand All @@ -39,7 +44,7 @@ const theme = useTheme();
label
>
<span>
{{ rom.type }}
{{ game.type }}
</span>
</v-chip></v-img
>
Expand Down
Loading