feat(market): settings toggle
This commit is contained in:
@@ -3,9 +3,16 @@ import { ref, onMounted } from "vue";
|
||||
import { gamesApiListGames } from "./api";
|
||||
import type { GamesApiListGamesResponse } from "./api/types.gen";
|
||||
|
||||
interface Props {
|
||||
marketEnabled?: string | boolean;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
marketEnabled: true,
|
||||
});
|
||||
|
||||
const games = ref<GamesApiListGamesResponse | undefined>();
|
||||
const loading = ref(true);
|
||||
|
||||
const imageErrors = ref<Set<number>>(new Set());
|
||||
|
||||
const getHeaderImage = (appId: number) => {
|
||||
@@ -20,7 +27,15 @@ const navigate = (path: string) => {
|
||||
window.location.href = path;
|
||||
};
|
||||
|
||||
const isMarketEnabled = () => {
|
||||
if (typeof props.marketEnabled === 'string') {
|
||||
return props.marketEnabled === 'true';
|
||||
}
|
||||
return Boolean(props.marketEnabled);
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
// Fetch games list
|
||||
const response = await gamesApiListGames();
|
||||
if (response.data) {
|
||||
games.value = response.data;
|
||||
@@ -48,7 +63,7 @@ onMounted(async () => {
|
||||
<!-- Cards Grid -->
|
||||
<div v-else class="grid grid-cols-1 md:grid-cols-2 gap-8">
|
||||
<!-- Market Card -->
|
||||
<div @click="navigate('/market')"
|
||||
<div v-if="isMarketEnabled()" @click="navigate('/market')"
|
||||
class="card card-xl bg-base-200 shadow-xl hover:shadow-2xl transition-all cursor-pointer transform hover:-translate-y-2 hover:scale-[1.05] hover:bg-base-100 overflow-hidden">
|
||||
<figure class="relative h-60 bg-gradient-to-br from-purple-600 to-blue-600 flex items-center justify-center">
|
||||
<i class="mdi mdi-chart-box text-6xl text-white opacity-80"></i>
|
||||
|
||||
Reference in New Issue
Block a user