Skip to content

Commit

Permalink
gallery modal improvements (see description)
Browse files Browse the repository at this point in the history
- versions are shortened like in /texture and /compare in the regular display
- the full list is still displayed on hover
- nameless uses now say they're nameless
  • Loading branch information
3vorp committed Jul 27, 2024
1 parent 4246104 commit 0fd5352
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
20 changes: 18 additions & 2 deletions pages/gallery/gallery-modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,17 @@
class="elevation-1"
style="margin-top: 10px"
hide-default-footer
/>
>
<template #item.versions="{ value }">
<!-- title property gives alt text -->
<span :title="value.join(', ')">{{ formatPathVersions(value) }}</span>
</template>
<!-- technically applies to both texture/use names but it doesn't matter -->
<template #item.name="{ value }">
<template v-if="value">{{ value }}</template>
<i v-else>{{ $root.lang().database.labels.nameless }}</i>
</template>
</v-data-table>
</div>
</template>
</template>
Expand Down Expand Up @@ -115,6 +125,7 @@

<script>
import moment from "moment";
import MinecraftSorter from "@helpers/MinecraftSorter";
import GalleryImage from "./gallery-image.vue";
import FullscreenPreview from "../components/fullscreen-preview.vue";
Expand Down Expand Up @@ -243,10 +254,15 @@ export default {
case "paths":
return this.textureObj[item].map((path) => ({
...path,
versions: path.versions.join(", "),
// sort() mutates the original array so we need to clone it
versions: Array.from(path.versions).sort(MinecraftSorter),
}));
}
},
formatPathVersions(versions) {
if (versions.length === 1) return versions[0];
return `${versions[0]}${versions[versions.length - 1]}`;
},
openFullscreenPreview(url) {
this.clickedImage = url;
this.previewOpen = true;
Expand Down
4 changes: 0 additions & 4 deletions resources/css/webapp.css
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,6 @@ img.texture-img {
border-bottom-right-radius: 6px;
}

td.text-start {
max-width: 6rem;
}

.v-chip {
border-radius: 4px !important;
}
Expand Down

0 comments on commit 0fd5352

Please sign in to comment.