forked from fayazara/zooper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correction de l'affichage des propriétés wikidata dans la page wikise…
…arch.vue
- Loading branch information
Showing
9 changed files
with
1,666 additions
and
202 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<template> | ||
<main class="space-y-8"> | ||
<div class="flex place-items-center gap-4"> | ||
<h1 class="text-primary text-xl">{{ TIT }} </h1> | ||
<UInput v-model = "search" variant = "outline" color = "gray" placeholder = "Rechercher une gravure"/> | ||
</div> | ||
|
||
<div v-auto-animate class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3 m-auto"> | ||
<QCard v-for="(val, id) in foundResults" :key="id" dark class="m-1 hover:scale-105 transition-all will-change-transform border-teal-400/20" :TIT="val.TIT" :REP="val.REP" bordered> | ||
<div class="h-48 lg:h-40 overflow-hidden relative"> | ||
<UAvatar class="absolute z-20 top-2 left-2 bg-gray-700" size="md"> | ||
<UIcon dynamic name="i-lucide-book" /> | ||
</UAvatar> | ||
<NuxtImg src="gravures/bnu.png" alt="bnu" height="300" width="400" class="opacity-30"/> | ||
|
||
</div> | ||
<div class="p-4"> | ||
<h2 class="text-xl font-bold">{{ val.TIT }}</h2> | ||
<p class="text-gray-400">{{ val.REP }}</p> | ||
<p class="mt-2"> | ||
<span v-for="(badge, i) in ['hey', 'you']" class="mr-2"> | ||
<UBadge :key="i" color="indigo" variant="outline"> | ||
{{ badge }} | ||
</UBadge> | ||
</span> | ||
</p> | ||
</div> | ||
</QCard> | ||
</div> | ||
|
||
<!-- <section> | ||
<pre>{{ data }}</pre> | ||
</section> --> | ||
</main> | ||
</template> | ||
|
||
<script setup> | ||
import { refDebounced } from '@vueuse/core' | ||
const { data } = await useFetch('/api/gravures') | ||
const search = ref('') | ||
const debounceSearch = refDebounced(search, 400) | ||
const foundResults = computed(() => | ||
debounceSearch.value.length < 3 ? data.value.result : | ||
data.value.result.filter(r => r.TIT.toUpperCase().includes(debounceSearch.value.toUpperCase())) | ||
) | ||
const baseUrl = 'https://dev-lab-one.vercel.app/' | ||
const valImg = val => { | ||
const img = val.image ?? "val-sparql.png" | ||
return "val/" + img | ||
} | ||
const TIT = "Gravures"; | ||
const REP = "Gravures et autres imprimés anciens et jolis"; | ||
useSeoMeta({ | ||
TIT: TIT, | ||
REP, | ||
author: "arthur.brody@bnu.fr", | ||
ogImage: baseUrl + "val/val-renaissance2.png", | ||
ogUrl: baseUrl, | ||
ogType: "website", | ||
ogTIT: TIT, | ||
ogREP: REP, | ||
robots: "index, follow", | ||
themeColor: "teal", | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import sqlite3 from "sqlite3"; | ||
const db = new sqlite3.Database("gravures_sqlite.db"); | ||
|
||
async function getGravures() { | ||
return new Promise((resolve, reject) => { | ||
// db.all("SELECT * FROM gravures", (error, rows) => { | ||
db.all("SELECT TIT, REP, REFG, COM FROM gravures LIMIT 100", (error, rows) => { | ||
if (error) { | ||
reject(error); | ||
} else { | ||
resolve(rows); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
var gravures: any; | ||
getGravures().then((g) => { | ||
gravures = g; | ||
}); | ||
|
||
export default defineEventHandler(async (event) => { | ||
await getGravures(); | ||
return { | ||
result: gravures, | ||
}; | ||
}); |
Oops, something went wrong.