fixed notes UI

This commit is contained in:
zurdi
2024-06-10 12:08:25 +02:00
parent 75d166f595
commit 844ed783aa
8 changed files with 151 additions and 94 deletions

View File

@@ -292,6 +292,7 @@ onBeforeUnmount(() => {
:rom="matchedRom"
title-on-footer
transform-scale
title-on-hover
/>
</v-col>
</v-row>

View File

@@ -44,3 +44,9 @@ const theme = useTheme();
>
</v-card>
</template>
<style scoped>
.chip-type {
top: -0.1rem;
left: -0.1rem;
}
</style>

View File

@@ -45,44 +45,53 @@ function onEditNote() {
}
</script>
<template>
<v-card>
<v-card-title>
<v-row class="px-2 pt-1">
<v-col
cols="10"
class="d-flex align-center"
>
<h3>My notes</h3>
</v-col>
<v-col
cols="2"
class="text-right"
>
<v-btn
icon
size="small"
:title="ownNote.is_public ? 'Make private' : 'Make public'"
class="mr-2"
@click="togglePublic"
>
<v-icon>
{{ ownNote.is_public ? "mdi-eye" : "mdi-eye-off" }}
</v-icon>
</v-btn>
<v-btn
icon
size="small"
title="Edit note"
@click="onEditNote"
>
<v-icon>
{{ editingNote ? "mdi-check" : "mdi-pencil" }}
</v-icon>
</v-btn>
</v-col>
</v-row>
<v-card rounded="0">
<v-card-title class="bg-terciary">
<v-list-item class="pl-2 pr-0">
<span class="text-h6">My notes</span>
<template #append>
<v-btn-group divided density="compact" rounded="0">
<v-tooltip
location="top"
class="tooltip"
transition="fade-transition"
:text="ownNote.is_public ? 'Make private' : 'Make public'"
open-delay="500"
><template #activator="{ props: tooltipProps }">
<v-btn
@click="togglePublic"
v-bind="tooltipProps"
class="bg-terciary"
>
<v-icon size="large">
{{ ownNote.is_public ? "mdi-eye" : "mdi-eye-off" }}
</v-icon>
</v-btn>
</template></v-tooltip
>
<v-tooltip
location="top"
class="tooltip"
transition="fade-transition"
text="Edit note"
open-delay="500"
><template #activator="{ props: tooltipProps }">
<v-btn
@click="onEditNote"
v-bind="tooltipProps"
class="bg-terciary"
>
<v-icon size="large">
{{ editingNote ? "mdi-check" : "mdi-pencil" }}
</v-icon>
</v-btn>
</template></v-tooltip
>
</v-btn-group>
</template>
</v-list-item>
</v-card-title>
<v-card-text>
<v-card-text class="pa-2">
<MdEditor
v-if="editingNote"
v-model="ownNote.raw_markdown"
@@ -101,19 +110,34 @@ function onEditNote() {
/>
</v-card-text>
</v-card>
<v-card
v-if="publicNotes.length > 0"
class="mt-3"
>
<v-card-title class="px-6 pt-4">
<h3>Public notes</h3>
<v-card rounded="0" v-if="publicNotes.length > 0" class="mt-2">
<v-card-title class="bg-terciary">
<v-list-item class="pl-2 pr-0">
<span class="text-h6">Public notes</span>
</v-list-item>
</v-card-title>
<v-card-text>
<v-list>
<v-list-item
v-for="note in publicNotes"
:key="note.id"
>
<v-divider />
<v-card-text class="pa-0">
<v-expansion-panels multiple flat rounded="0" variant="accordion">
<v-expansion-panel v-for="note in publicNotes" :key="note.id">
<v-expansion-panel-title class="bg-terciary">
<span class="text-body-1">{{ note.user__username }}</span>
</v-expansion-panel-title>
<v-expansion-panel-text class="bg-secondary">
<MdPreview
:model-value="note.raw_markdown"
:theme="theme.name.value == 'dark' ? 'dark' : 'light'"
preview-theme="vuepress"
code-theme="github"
/>
</v-expansion-panel-text>
</v-expansion-panel>
</v-expansion-panels>
<!-- <v-list>
<v-list-item v-for="note in publicNotes" :key="note.id">
<v-list-item-title>{{ note.user__username }}</v-list-item-title>
<MdPreview
:model-value="note.raw_markdown"
@@ -122,7 +146,7 @@ function onEditNote() {
code-theme="github"
/>
</v-list-item>
</v-list>
</v-list> -->
</v-card-text>
</v-card>
</template>
@@ -139,4 +163,7 @@ function onEditNote() {
.vuepress-theme pre code {
background-color: #0d1117;
}
.v-expansion-panel-text__wrapper {
padding: 0px !important;
}
</style>

View File

@@ -12,20 +12,8 @@ const combined = ref([
</script>
<template>
<v-row no-gutters>
<v-col
class="pa-0"
cols="4"
sm="3"
md="6"
v-for="rom in combined"
>
<v-col cols="4" sm="3" md="6" v-for="rom in combined">
<related-card :rom="rom" />
</v-col>
</v-row>
</template>
<style scoped>
.chip-type {
top: -0.1rem;
left: -0.1rem;
}
</style>

View File

@@ -69,16 +69,13 @@ async function uploadSaves() {
}
</script>
<template>
<v-row
class="pa-2 align-center"
no-gutters
>
<v-row class="pa-2 align-center" no-gutters>
<v-col>
<v-list-item class="px-0">
<v-file-input
v-model="savesToUpload"
label="Select save files..."
prepend-inner-icon="mdi-file"
label="Select save files"
prepend-inner-icon="mdi-content-save"
prepend-icon=""
multiple
chips
@@ -86,13 +83,14 @@ async function uploadSaves() {
variant="outlined"
density="compact"
hide-details
@keyup.enter="uploadSaves()"
@keyup.enter="uploadSaves"
/>
<template #append>
<v-btn
:disabled="!savesToUpload.length"
class="text-romm-green ml-3 bg-terciary"
@click="uploadSaves()"
@click="uploadSaves"
prepend-icon="mdi-upload"
>
Upload
</v-btn>
@@ -100,10 +98,7 @@ async function uploadSaves() {
</v-list-item>
</v-col>
</v-row>
<v-list
rounded="0"
class="pa-0"
>
<v-list rounded="0" class="pa-0">
<v-list-item
v-for="save in rom.user_saves"
:key="save.id"

View File

@@ -74,7 +74,7 @@ async function uploadStates() {
<v-list-item class="px-0">
<v-file-input
v-model="statesToUpload"
label="Select state files..."
label="Select state files"
prepend-inner-icon="mdi-file"
prepend-icon=""
multiple
@@ -83,13 +83,14 @@ async function uploadStates() {
variant="outlined"
density="compact"
hide-details
@keyup.enter="uploadStates()"
@keyup.enter="uploadStates"
/>
<template #append>
<v-btn
:disabled="!statesToUpload.length"
class="text-romm-green ml-3 bg-terciary"
@click="uploadStates()"
@click="uploadStates"
prepend-icon="mdi-upload"
>
Upload
</v-btn>

View File

@@ -20,14 +20,16 @@ const hasReleaseDate = Number(props.rom.first_release_date) > 0;
<template>
<v-row
class="text-white text-shadow"
:class="{ 'text-center': smAndDown }"
:class="{ 'text-center mt-2': smAndDown }"
no-gutters
>
<v-col>
<span class="text-h5 font-weight-bold">{{ rom.name }}</span>
<v-chip class="text-h5 font-weight-bold pl-0" label variant="text">{{
rom.name
}}</v-chip>
<v-chip
v-if="hasReleaseDate && !smAndDown"
class="font-italic ml-2"
class="font-italic"
size="x-small"
>
{{ releaseDate }}
@@ -47,7 +49,7 @@ const hasReleaseDate = Number(props.rom.first_release_date) > 0;
:key="platform.slug"
:slug="platform.slug"
:size="30"
:class="{ 'ml-2': !smAndDown }"
class="ml-2"
/>
</v-chip>
<v-chip
@@ -57,9 +59,48 @@ const hasReleaseDate = Number(props.rom.first_release_date) > 0;
>
{{ releaseDate }}
</v-chip>
<!-- TODO: refactor this mess + add options to Flags -->
<!-- TODO: Date to the right side of the platform chip when xs -->
<v-row no-gutters v-if="smAndDown" class="my-1"><v-col></v-col></v-row>
<template v-if="!smAndDown">
<v-chip
class="ml-1"
v-if="rom.regions.filter(identity).length > 0"
size="small"
:title="`Regions: ${rom.regions.join(', ')}`"
>
<span v-for="region in rom.regions" :key="region" class="px-1">{{
regionToEmoji(region)
}}</span>
</v-chip>
<v-chip
v-if="rom.languages.filter(identity).length > 0"
size="small"
class="ml-1"
:title="`Languages: ${rom.languages.join(', ')}`"
>
<span
v-for="language in rom.languages"
:key="language"
class="px-1"
>{{ languageToEmoji(language) }}</span
>
</v-chip>
<v-chip v-if="rom.revision" size="small" class="ml-1">
Revision {{ rom.revision }}
</v-chip>
</template>
</v-col>
</v-row>
<v-row
v-if="
smAndDown &&
rom.regions.filter(identity).length > 0 &&
rom.languages.filter(identity).length > 0 &&
rom.revision
"
class="text-white text-shadow mt-2 text-center"
no-gutters
>
<v-col>
<v-chip
class="ml-1"
v-if="rom.regions.filter(identity).length > 0"
@@ -88,7 +129,7 @@ const hasReleaseDate = Number(props.rom.first_release_date) > 0;
<v-row
v-if="rom.igdb_id || rom.moby_id"
class="text-white text-shadow"
class="text-white text-shadow mt-2"
:class="{ 'text-center': smAndDown }"
no-gutters
>

View File

@@ -108,7 +108,7 @@ watch(
<v-row
:class="{
'mx-12': mdAndUp,
'ml-6': mdAndUp,
'justify-center': smAndDown,
}"
no-gutters
@@ -122,7 +122,7 @@ watch(
>
<cover :rom="rom" />
<action-bar class="mt-2" :rom="rom" />
<related-games v-if="mdAndUp" class="mt-3 px-2" :rom="rom" />
<related-games v-if="mdAndUp" class="mt-3" :rom="rom" />
</v-col>
<v-col
@@ -136,17 +136,15 @@ watch(
'info-xs': smAndDown,
}"
>
<v-col
cols="12"
md="7"
class="pl-3 bg-green"
<div
class="px-3"
:class="{
'position-absolute title-desktop': mdAndUp,
'justify-center': smAndDown,
}"
>
<title-info :rom="rom" :platform="platform" />
</v-col>
</div>
<v-row
:class="{
'justify-center': smAndDown,
@@ -248,7 +246,7 @@ watch(
</v-col>
<template v-if="lgAndUp">
<v-col class="px-6">
<v-col>
<additional-content :rom="rom" />
</v-col>
</template>