feat: switch to nuxt images

This commit is contained in:
Huskydog9988
2025-04-19 15:17:08 -04:00
parent 58435a9e7a
commit ccd8653be9
14 changed files with 701 additions and 75 deletions

View File

@@ -8,7 +8,12 @@ export default defineNuxtConfig({
enabled: true,
},
},
modules: ["@nuxtjs/tailwindcss", "vue3-carousel-nuxt", "@nuxt/fonts"],
modules: [
"@nuxtjs/tailwindcss",
"vue3-carousel-nuxt",
"@nuxt/image",
"@nuxt/fonts",
],
extends: ["./drop-base"],
css: ["~/assets/core.scss"],
app: {
@@ -21,8 +26,12 @@ export default defineNuxtConfig({
},
nitro: {
preset: "static",
minify: true,
compressPublicAssets: true,
prerender: {
crawlLinks: true,
},
},
fonts: {
@@ -87,13 +96,14 @@ export default defineNuxtConfig({
},
typescript: {
typeCheck: true,
typeCheck: false,
tsConfig: {
compilerOptions: {
verbatimModuleSyntax: false,
strictNullChecks: true,
exactOptionalPropertyTypes: true,
skipLibCheck: true,
},
},
},

View File

@@ -14,6 +14,7 @@
"@headlessui/vue": "^1.7.23",
"@heroicons/vue": "^2.2.0",
"@nuxt/fonts": "0.11.1",
"@nuxt/image": "1.10.0",
"@nuxtjs/tailwindcss": "6.13.1",
"nuxt": "^3.16.2",
"vue": "latest",
@@ -23,6 +24,7 @@
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
"devDependencies": {
"sass-embedded": "^1.83.4",
"serve": "^14.2.4",
"typescript": "^5.8.3",
"vue-tsc": "^2.2.8"
},
@@ -31,4 +33,4 @@
"vue3-carousel": "^0.15.0"
}
}
}
}

View File

@@ -17,10 +17,13 @@
</div>
<div class="relative overflow-hidden pt-16">
<div class="mx-auto max-w-7xl px-6 lg:px-8">
<img
src="@/assets/ss/admin-metadata.png"
alt="App screenshot"
<NuxtImg
src="/images/ss/admin-metadata.png"
alt="App screenshot"
class="rounded-xl shadow-2xl ring-1 ring-white/10"
quality="80"
format="webp"
preload
/>
</div>
</div>
@@ -50,7 +53,12 @@
</template>
<script setup lang="ts">
import { DocumentDuplicateIcon, PencilIcon, ServerStackIcon } from "@heroicons/vue/24/outline";
import { NuxtImg } from "#components";
import {
DocumentDuplicateIcon,
PencilIcon,
ServerStackIcon,
} from "@heroicons/vue/24/outline";
const features = [
{
@@ -74,6 +82,6 @@ const features = [
];
useHead({
title: "Library"
})
title: "Library",
});
</script>

View File

@@ -22,34 +22,53 @@
<a
href="https://github.com/Drop-OSS/drop-app/releases"
class="inline-flex items-center gap-x-2 rounded-md bg-zinc-900 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-zinc-950 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-400"
>Download <ArrowDownTrayIcon class="size-4" /> </a
>
>Download <ArrowDownTrayIcon class="size-4" />
</a>
</div>
</div>
<div
class="mt-16 rounded-md sm:mt-24 bg-white/5 shadow-2xl ring-1 ring-white/10 p-2"
>
<ClientOnly fallback-tag="span">
<VueCarousel
:wrapAround="true"
:items-to-show="1"
:autoplay="15 * 1000"
:pauseAutoplayOnHover="true"
>
<VueSlide v-for="image in images" :key="image">
<img class="w-full rounded-md" :src="image" />
</VueSlide>
<VueCarousel
:wrapAround="true"
:items-to-show="1"
:autoplay="15 * 1000"
:pauseAutoplayOnHover="true"
>
<VueSlide v-for="(image, i) in images" :key="i">
<!-- when editing this, make sure to change values in prerender thing below -->
<NuxtImg
class="w-full rounded-md"
:src="image"
quality="80"
format="webp"
:placeholder="[100, 100, 75, 5]"
/>
</VueSlide>
<template #addons>
<VueNavigation />
</template>
</VueCarousel>
<template #addons>
<VueNavigation />
</template>
</VueCarousel>
<template #fallback>
<div
class="flex flex-nowrap flex-row overflow-hidden whitespace-nowrap"
>
<p>Loading carousel...</p>
</div>
<!-- Invisible pre-rendering hint -->
<div class="hidden">
<NuxtImg
v-for="img in allImages"
:key="img"
:src="img"
quality="80"
format="webp"
preload
:placeholder="[100, 100, 75, 5]"
/>
</div>
</template>
</ClientOnly>
</div>
@@ -71,10 +90,13 @@
class="w-full overflow-hidden rounded-lg bg-zinc-800 ring-1 ring-white/15 max-lg:rounded-t-[2rem] lg:rounded-tl-[2rem]"
>
<div class="squiggles relative h-80 w-full overflow-hidden">
<img
<NuxtImg
class="absolute rotate-[-6deg] left-[25%] w-[30rem] z-10 rounded-md"
src="@/assets/updates.png"
src="/images/updates.png"
alt=""
quality="80"
format="webp"
loading="lazy"
/>
</div>
<div class="p-10">
@@ -95,10 +117,13 @@
class="overflow-hidden rounded-lg bg-zinc-800 ring-1 ring-white/15 lg:rounded-tr-[2rem]"
>
<div class="hexagons relative h-80 w-full overflow-hidden">
<img
<NuxtImg
class="absolute rotate-[-6deg] top-[20%] w-[30rem] z-10 rounded-md"
src="@/assets/proton.webp"
src="/images/proton.webp"
alt=""
quality="80"
format="webp"
loading="lazy"
/>
</div>
<div class="p-10">
@@ -142,7 +167,7 @@
<div
class="w-full overflow-hidden rounded-lg bg-zinc-800 ring-1 ring-white/15 max-lg:rounded-b-[2rem] lg:rounded-br-[2rem]"
>
<div class="bubbles relative h-80 w-full overflow-hidden">
<div class="bubbles relative h-80 w-full overflow-hidden">
<P2PIconPlaceholder
class="text-zinc-300 absolute rotate-[0deg] left-1/2 -translate-x-1/2 top-[5%] w-[20rem] z-10 rounded-md"
alt=""
@@ -185,18 +210,37 @@ import { ArrowDownTrayIcon, UserGroupIcon } from "@heroicons/vue/24/outline";
const imageNames = ["hzd.png", "store.png", "hl.png"];
const desktopImages = computed(() =>
imageNames.map((e) => `/images/carousel/${e}`)
);
const mobileImages = computed(() =>
imageNames.map((e) => `/images/carousel/mobile/${e}`)
);
const allImages = computed(() => [
...desktopImages.value,
...mobileImages.value,
]);
const images = ref<string[]>([]);
onMounted(() => {
const handleResize = () => {
const width = window.innerWidth;
if (width <= 640) {
images.value = imageNames.map((e) => `/carousel/mobile/${e}`);
images.value = mobileImages.value;
} else {
images.value = imageNames.map((e) => `/carousel/${e}`);
images.value = desktopImages.value;
}
};
onMounted(() => {
handleResize();
window.addEventListener("resize", handleResize);
});
onBeforeUnmount(() => {
window.removeEventListener("resize", handleResize);
});
useHead({
title: "Home"
})
title: "Home",
});
</script>

View File

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

Before

Width:  |  Height:  |  Size: 256 KiB

After

Width:  |  Height:  |  Size: 256 KiB

View File

Before

Width:  |  Height:  |  Size: 294 KiB

After

Width:  |  Height:  |  Size: 294 KiB

View File

Before

Width:  |  Height:  |  Size: 287 KiB

After

Width:  |  Height:  |  Size: 287 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 MiB

After

Width:  |  Height:  |  Size: 3.0 MiB

View File

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

644
yarn.lock

File diff suppressed because it is too large Load Diff