From c41e8ec40f83b78097d8f019e98ef86090a3488c Mon Sep 17 00:00:00 2001 From: zurdi Date: Fri, 25 Oct 2024 16:19:53 +0000 Subject: [PATCH 1/2] fixed rom personal details on mobile --- frontend/src/components/Details/Personal.vue | 194 +++++++++++-------- frontend/src/utils/index.ts | 25 ++- 2 files changed, 140 insertions(+), 79 deletions(-) diff --git a/frontend/src/components/Details/Personal.vue b/frontend/src/components/Details/Personal.vue index f383f82f5..bbe0d72a3 100644 --- a/frontend/src/components/Details/Personal.vue +++ b/frontend/src/components/Details/Personal.vue @@ -3,40 +3,27 @@ import romApi from "@/services/api/rom"; import storeAuth from "@/stores/auth"; import type { DetailedRom } from "@/stores/roms"; import type { RomUserStatus } from "@/__generated__"; -import { getTextForStatus } from "@/utils"; +import { difficultyEmojis, getTextForStatus, getEmojiForStatus } from "@/utils"; import { MdEditor, MdPreview } from "md-editor-v3"; import "md-editor-v3/lib/style.css"; import { ref, watch } from "vue"; -import { useTheme } from "vuetify"; +import { useDisplay, useTheme } from "vuetify"; const props = defineProps<{ rom: DetailedRom }>(); const auth = storeAuth(); const theme = useTheme(); +const { smAndDown } = useDisplay(); const editingNote = ref(false); const romUser = ref(props.rom.rom_user); const publicNotes = props.rom.user_notes?.filter((note) => note.user_id !== auth.user?.id) ?? []; -const difficultyEmojis = [ - "😴", - "🥱", - "😐", - "😄", - "🤔", - "🤯", - "😓", - "😡", - "🤬", - "😵", -]; - const statusOptions = [ - null, + "never_playing", + "retired", "incomplete", "finished", "completed_100", - "retired", - "never_playing", ]; function editNote() { @@ -77,88 +64,137 @@ watch( Status - - - + + + + > + + + > + + - - -
- Rating - -
-
- Difficulty - - - {{ - difficultyEmojis[Math.floor(romUser.difficulty) - 1] ?? "😀" - }} + -
-
- Completion % - - - {{ romUser.completion }}% - -
-
+ + + + + + Rating + + + + + + + + Difficulty + + + + + + + {{ + difficultyEmojis[Math.floor(romUser.difficulty) - 1] ?? + difficultyEmojis[3] + }} + + + + + + Completion % + + + + + + {{ romUser.completion }}% + + +
@@ -175,6 +214,7 @@ watch( + diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts index 963ca6466..faee99ca9 100644 --- a/frontend/src/utils/index.ts +++ b/frontend/src/utils/index.ts @@ -369,6 +369,19 @@ export function isRuffleEmulationSupported( type PlayingStatus = RomUserStatus | "backlogged" | "now_playing" | "hidden"; +export const difficultyEmojis = [ + "😴", + "🥱", + "😐", + "😄", + "🤔", + "🤯", + "😓", + "😡", + "🤬", + "😵", +]; + export const romStatusMap: Record< PlayingStatus, { emoji: string; text: string } @@ -388,11 +401,19 @@ const inverseRomStatusMap = Object.fromEntries( ) as Record; export function getEmojiForStatus(status: PlayingStatus) { - return romStatusMap[status].emoji; + if (status) { + return romStatusMap[status].emoji; + } else { + return null; + } } export function getTextForStatus(status: PlayingStatus) { - return romStatusMap[status].text; + if (status) { + return romStatusMap[status].text; + } else { + return null; + } } export function getStatusKeyForText(text: string) { From 43e9365c7ba7456cd5114d13d7fcb74fdf8a95f1 Mon Sep 17 00:00:00 2001 From: zurdi Date: Tue, 29 Oct 2024 15:40:49 +0000 Subject: [PATCH 2/2] fixed margin for personal tab --- frontend/src/components/Details/Personal.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/Details/Personal.vue b/frontend/src/components/Details/Personal.vue index bbe0d72a3..8624f4768 100644 --- a/frontend/src/components/Details/Personal.vue +++ b/frontend/src/components/Details/Personal.vue @@ -12,7 +12,7 @@ import { useDisplay, useTheme } from "vuetify"; const props = defineProps<{ rom: DetailedRom }>(); const auth = storeAuth(); const theme = useTheme(); -const { smAndDown } = useDisplay(); +const { mdAndUp, smAndDown } = useDisplay(); const editingNote = ref(false); const romUser = ref(props.rom.rom_user); const publicNotes = @@ -119,7 +119,7 @@ watch(