Skip to content

Commit

Permalink
Merge pull request #44 from adydetra/main
Browse files Browse the repository at this point in the history
chore: lint
  • Loading branch information
adydetra authored Jul 7, 2024
2 parents 12305bf + bf299d8 commit ca5c192
Show file tree
Hide file tree
Showing 4 changed files with 3,030 additions and 2,341 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Ensik Archive is a captivating online gallery platform dedicated to preserving a

## Features

✔️  **Minimalist:** Clean design layout
✔️ **Minimalist:** Clean design layout

✔️  **Filter:** Sort photo by publisher or date
✔️ **Filter:** Sort photo by publisher or date

✔️  **Fast:** Compressed photo & lazy load
✔️ **Fast:** Compressed photo & lazy load

## Built with

Expand Down
53 changes: 28 additions & 25 deletions components/card.vue
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
<template>
<div class="columns-1 sm:columns-2 md:columns-3 lg:columns-4 gap-8 py-12 space-y-8">
<NuxtImg v-for="item in img" :key="item.i" :src="item.i" :class="imgStyle" loading="lazy" alt="" />
</div>
</template>

<script setup>
const imgStyle = "rounded-lg";
const supabase = useSupabaseClient();
const imgStyle = 'rounded-lg';
const img = ref([]);
const postFileNames = ref([]);
async function fetchPostFileNames() {
try {
const { data, error } = await supabase.storage.from("post").list("", {
const { data, error } = await supabase.storage.from('post').list('', {
limit: 1000,
offset: 0,
sortBy: { column: "name", order: "asc" },
sortBy: { column: 'name', order: 'asc' },
});
if (error) {
if (error)
console.error(error);
} else if (data && data.length > 0) {
return data.map((item) => item.name);
}
} catch (error) {
else if (data && data.length > 0)
return data.map(item => item.name);
}
catch (error) {
console.error(error);
}
}
Expand All @@ -30,37 +26,44 @@ async function getPhotoUrls(fileNames) {
try {
const signedUrls = await Promise.all(
fileNames.map(async (fileName) => {
const { data, error } = await supabase.storage.from("post").createSignedUrl(fileName, 60);
const { data, error } = await supabase.storage.from('post').createSignedUrl(fileName, 60);
if (error) {
console.error(error);
return null;
} else if (data && data.signedUrl) {
}
else if (data && data.signedUrl) {
return data.signedUrl;
} else {
}
else {
return null;
}
})
}),
);
return signedUrls.filter((url) => url !== null);
} catch (error) {
return signedUrls.filter(url => url !== null);
}
catch (error) {
console.error(error);
return [];
}
}
const img = ref([]);
const postFileNames = ref([]);
onMounted(async () => {
const fileNames = await fetchPostFileNames();
if (fileNames && fileNames.length > 0) {
postFileNames.value = fileNames;
const photoUrls = await getPhotoUrls(fileNames);
img.value = photoUrls.map((url, i) => ({ i: url }));
} else {
img.value = photoUrls.map((url, _i) => ({ i: url }));
}
else {
console.error('No files found in the "post" bucket.');
}
});
</script>

<template>
<div class="columns-1 sm:columns-2 md:columns-3 lg:columns-4 gap-8 py-12 space-y-8">
<NuxtImg v-for="item in img" :key="item.i" :src="item.i" :class="imgStyle" loading="lazy" alt="" />
</div>
</template>
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
"@nuxtjs/tailwindcss": "^6.12.0"
},
"devDependencies": {
"@antfu/eslint-config": "^2.15.0",
"@antfu/eslint-config": "^2.20.0",
"@nuxt/devtools": "1.2.0",
"@nuxt/image": "^1.6.0",
"@nuxt/image": "^1.7.0",
"@nuxtjs/google-fonts": "^3.2.0",
"@nuxtjs/supabase": "^1.2.1",
"@types/node": "^20.12.7",
"eslint": "^9.1.1",
"@nuxtjs/supabase": "^1.2.2",
"@types/node": "^20.14.2",
"eslint": "^9.4.0",
"eslint-plugin-format": "^0.1.1",
"nuxt": "^3.11.2"
"nuxt": "^3.12.3"
}
}
Loading

0 comments on commit ca5c192

Please sign in to comment.