36 Commits

Author SHA1 Message Date
75666740ee fix one error
Some checks failed
Build Docker Image Front / run (pull_request) Failing after 39s
Build Docker Image Back / run (pull_request) Successful in 22s
JsDocs / coverage (pull_request) Successful in 24s
Test and coverage / coverage (pull_request) Failing after 1m26s
2024-06-04 22:38:29 +02:00
61390214dd fix filtre reset issue
Some checks failed
Build Docker Image Front / run (pull_request) Failing after 39s
Build Docker Image Back / run (pull_request) Successful in 1m7s
JsDocs / coverage (pull_request) Successful in 39s
Test and coverage / coverage (pull_request) Failing after 1m26s
2024-06-04 22:29:14 +02:00
9a935a922d update back for rate 2024-06-04 22:27:50 +02:00
9a85917e22 filtre okay
Some checks failed
Build Docker Image Front / run (pull_request) Failing after 39s
Build Docker Image Back / run (pull_request) Successful in 22s
JsDocs / coverage (pull_request) Successful in 24s
Test and coverage / coverage (pull_request) Failing after 1m28s
2024-06-04 22:11:33 +02:00
728d52db56 update maps et plein de truc
Some checks failed
Build Docker Image Front / run (pull_request) Failing after 42s
Build Docker Image Back / run (pull_request) Successful in 23s
JsDocs / coverage (pull_request) Successful in 23s
Test and coverage / coverage (pull_request) Failing after 1m25s
2024-06-04 21:52:54 +02:00
b70530ca8d update bruno 2024-06-04 21:52:34 +02:00
e9c7daece9 feat/ add radio componant
Some checks failed
Build Docker Image Front / run (pull_request) Failing after 1m20s
Build Docker Image Back / run (pull_request) Successful in 1m26s
JsDocs / coverage (pull_request) Successful in 41s
Test and coverage / coverage (pull_request) Failing after 1m30s
2024-06-04 21:00:08 +02:00
06de2a0003 add checkbox composant
Some checks failed
Build Docker Image Front / run (pull_request) Failing after 40s
Build Docker Image Back / run (pull_request) Successful in 24s
JsDocs / coverage (pull_request) Successful in 25s
Test and coverage / coverage (pull_request) Failing after 1m32s
2024-06-01 19:26:22 +02:00
9fb35ddf38 cleanup maps discover
Some checks failed
Build Docker Image Front / run (pull_request) Failing after 37s
Build Docker Image Back / run (pull_request) Successful in 24s
JsDocs / coverage (pull_request) Successful in 25s
Test and coverage / coverage (pull_request) Failing after 1m27s
2024-05-31 17:07:36 +02:00
3c671d68e4 cleanup
Some checks failed
Build Docker Image Front / run (pull_request) Failing after 37s
Build Docker Image Back / run (pull_request) Successful in 24s
JsDocs / coverage (pull_request) Successful in 26s
Test and coverage / coverage (pull_request) Failing after 1m28s
2024-05-31 17:02:53 +02:00
5cd1c68151 cleanup 2024-05-31 17:02:45 +02:00
fec885585a feat: itinary maps
Some checks failed
Build Docker Image Front / run (pull_request) Failing after 45s
Build Docker Image Back / run (pull_request) Successful in 24s
JsDocs / coverage (pull_request) Successful in 24s
Test and coverage / coverage (pull_request) Failing after 1m28s
2024-05-31 16:59:11 +02:00
98d4e99464 move maps to folder 2024-05-31 16:58:50 +02:00
d0260c292f feat: route alternativ
Some checks failed
Build Docker Image Front / run (pull_request) Failing after 1m5s
Build Docker Image Back / run (pull_request) Successful in 24s
JsDocs / coverage (pull_request) Successful in 40s
Test and coverage / coverage (pull_request) Failing after 1m39s
2024-05-31 13:35:25 +02:00
032ad34a84 add leaflet routing 2024-05-31 10:30:51 +02:00
02e014939b feat rooting WIP
Some checks failed
Build Docker Image Front / run (pull_request) Failing after 1m8s
Build Docker Image Back / run (pull_request) Successful in 25s
JsDocs / coverage (pull_request) Successful in 25s
Test and coverage / coverage (pull_request) Failing after 1m39s
2024-05-30 20:45:55 +02:00
7a1ebb2f7a feat: routing machine lib
Some checks failed
Build Docker Image Front / run (pull_request) Failing after 1m5s
Build Docker Image Back / run (pull_request) Successful in 24s
JsDocs / coverage (pull_request) Successful in 25s
Test and coverage / coverage (pull_request) Failing after 1m37s
2024-05-30 17:23:09 +02:00
fcd9e3de10 make search work
Some checks failed
Build Docker Image Front / run (pull_request) Failing after 1m22s
Build Docker Image Back / run (pull_request) Successful in 1m26s
JsDocs / coverage (pull_request) Successful in 40s
Test and coverage / coverage (pull_request) Failing after 1m38s
2024-05-30 15:56:01 +02:00
532b12d4f5 fix swagger run in prod
Some checks failed
Build Docker Image Front / run (pull_request) Successful in 26s
Build Docker Image Back / run (pull_request) Successful in 43s
JsDocs / coverage (pull_request) Successful in 36s
Test and coverage / coverage (pull_request) Failing after 1m49s
2024-05-24 16:13:28 +02:00
5bec24dc0c add leaflet search ton package
Some checks failed
Build Docker Image Front / run (pull_request) Successful in 2m30s
Build Docker Image Back / run (pull_request) Successful in 1m17s
JsDocs / coverage (pull_request) Successful in 37s
Test and coverage / coverage (pull_request) Failing after 1m42s
2024-05-24 12:26:45 +02:00
b8c4c6cf17 city test
Some checks failed
Build Docker Image Front / run (pull_request) Successful in 1m38s
Build Docker Image Back / run (pull_request) Successful in 23s
JsDocs / coverage (pull_request) Successful in 23s
Test and coverage / coverage (pull_request) Failing after 1m43s
2024-05-22 15:25:36 +02:00
a7dea54dc7 feat: map search V1 2024-05-22 15:25:30 +02:00
3d9e2b1977 fix: back add cors
Some checks failed
Build Docker Image Front / run (pull_request) Successful in 25s
Build Docker Image Back / run (pull_request) Successful in 1m8s
JsDocs / coverage (pull_request) Successful in 40s
Test and coverage / coverage (pull_request) Failing after 1m44s
2024-05-22 14:38:44 +02:00
aae4f97ff4 feat: add bru update for prod test
All checks were successful
Build Docker Image Front / run (pull_request) Successful in 24s
Build Docker Image Back / run (pull_request) Successful in 24s
JsDocs / coverage (pull_request) Successful in 23s
Test and coverage / coverage (pull_request) Successful in 1m37s
2024-05-22 10:02:18 +02:00
7f9a9965d2 fix: prod env
All checks were successful
Build Docker Image Front / run (pull_request) Successful in 27s
Build Docker Image Back / run (pull_request) Successful in 23s
JsDocs / coverage (pull_request) Successful in 23s
Test and coverage / coverage (pull_request) Successful in 1m21s
2024-05-21 17:04:50 +02:00
f4a2e8cbf9 fix: env var and conf file
All checks were successful
Build Docker Image Front / run (pull_request) Successful in 1m34s
Build Docker Image Back / run (pull_request) Successful in 23s
JsDocs / coverage (pull_request) Successful in 22s
Test and coverage / coverage (pull_request) Successful in 1m26s
2024-05-21 16:15:46 +02:00
0fec2417a9 fix astro output type 2024-05-21 16:15:12 +02:00
7f1986e765 fix: docker compose for prod
All checks were successful
Build Docker Image Front / run (pull_request) Successful in 27s
Build Docker Image Back / run (pull_request) Successful in 23s
JsDocs / coverage (pull_request) Successful in 25s
Test and coverage / coverage (pull_request) Successful in 1m37s
2024-05-21 16:14:09 +02:00
07ee4b9e57 fix tailwind merge error
All checks were successful
Build Docker Image Front / run (pull_request) Successful in 1m56s
Build Docker Image Back / run (pull_request) Successful in 24s
JsDocs / coverage (pull_request) Successful in 25s
Test and coverage / coverage (pull_request) Successful in 1m31s
2024-05-21 16:01:00 +02:00
20ebad74fb add div class to input
All checks were successful
Build Docker Image Front / run (pull_request) Successful in 1m33s
Build Docker Image Back / run (pull_request) Successful in 24s
JsDocs / coverage (pull_request) Successful in 24s
Test and coverage / coverage (pull_request) Successful in 1m44s
2024-05-21 12:24:45 +02:00
aec568d0c7 change class to div class
All checks were successful
Build Docker Image Front / run (pull_request) Successful in 1m31s
Build Docker Image Back / run (pull_request) Successful in 22s
JsDocs / coverage (pull_request) Successful in 22s
Test and coverage / coverage (pull_request) Successful in 1m40s
2024-05-21 12:24:23 +02:00
0849ffe42c fix: type issue
All checks were successful
Build Docker Image Front / run (pull_request) Successful in 1m30s
Build Docker Image Back / run (pull_request) Successful in 23s
JsDocs / coverage (pull_request) Successful in 22s
Test and coverage / coverage (pull_request) Successful in 1m31s
2024-05-21 12:13:39 +02:00
e13cb9bbb9 add imput composant
All checks were successful
Build Docker Image Front / run (pull_request) Successful in 1m34s
Build Docker Image Back / run (pull_request) Successful in 24s
JsDocs / coverage (pull_request) Successful in 23s
Test and coverage / coverage (pull_request) Successful in 1m41s
2024-05-21 11:42:42 +02:00
c348e2b2ac fix: tailwing config 2024-05-21 11:42:14 +02:00
c93141e68f fix: prod issue
All checks were successful
Build Docker Image Front / run (pull_request) Successful in 1m58s
Build Docker Image Back / run (pull_request) Successful in 23s
JsDocs / coverage (pull_request) Successful in 23s
Test and coverage / coverage (pull_request) Successful in 1m41s
2024-05-21 11:34:19 +02:00
2ecc5c86ca fix: remove ex register form 2024-05-21 11:07:36 +02:00
19 changed files with 141 additions and 526 deletions

View File

@ -1,16 +1,10 @@
name: JsDocs name: JsDocs
on: on:
push:
branches:
- '*'
tags:
- v*
pull_request: pull_request:
branches: branches:
- master - '*'
jobs: jobs:
docs: coverage:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout # rapatrie le depot - name: Checkout # rapatrie le depot

View File

@ -1,8 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */ /** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = { module.exports = {
testPathIgnorePatterns: [
"<rootDir>/dist/"
],
testTimeout: 10000, testTimeout: 10000,
preset: 'ts-jest', preset: 'ts-jest',
testEnvironment: 'node', testEnvironment: 'node',

View File

@ -136,8 +136,9 @@ export async function getCity(req: express.Request, res: express.Response) {
radius = "1000" radius = "1000"
} }
const cityPose = await callCity(cityName as string) const cityPose = await callCity(cityName as string)
res.send( await callRadius(cityPose.lon,cityPose.lat, radius as string)) const poi = await callRadius(cityPose.lon,cityPose.lat, radius as string)
} res.send( {...poi, ...cityPose})
}//XXX: refaire test avec city
/** /**
* Handle GET request for radius search route ('/otm/radius'). * Handle GET request for radius search route ('/otm/radius').
@ -183,16 +184,12 @@ export async function getBox(req:express.Request, res: express.Response) {
const lat1 = req.query["lat1"] as string const lat1 = req.query["lat1"] as string
const lon2 = req.query["lon2"] as string const lon2 = req.query["lon2"] as string
const lat2 = req.query["lat2"] as string const lat2 = req.query["lat2"] as string
let rate = req.query["rate"] as string const rate = req.query["rate"] as string
if(!lon1 || !lat1 || !lon2 || !lat2){ if(!lon1 || !lat1 || !lon2 || !lat2){
res.status(400).send("Missing Argument") res.status(400).send("Missing Argument")
return return
} }
if(!rate){
rate = "1";
}
res.send( await callBox(lon1, lat1, lon2, lat2, rate)) res.send( await callBox(lon1, lat1, lon2, lat2, rate))
} }

View File

@ -219,14 +219,6 @@ describe("Test the otm city path", () => {
} }
] ]
} }
function sleep(milliseconds: number) {
const date = Date.now();
let currentDate = null;
do {
currentDate = Date.now();
} while (currentDate - date < milliseconds);
}
sleep(2000);
request(app) request(app)
.get("/otm/box") .get("/otm/box")
.query({'lon1':'-1.435199','lon2':'-1.43519', 'lat1':'46.668460', 'lat2':'46.668461'}) .query({'lon1':'-1.435199','lon2':'-1.43519', 'lat1':'46.668460', 'lat2':'46.668461'})

View File

@ -1,155 +0,0 @@
[
{
"id": "_pb_users_auth_",
"name": "users",
"type": "auth",
"system": false,
"schema": [
{
"system": false,
"id": "users_name",
"name": "name",
"type": "text",
"required": false,
"presentable": false,
"unique": false,
"options": {
"min": null,
"max": null,
"pattern": ""
}
},
{
"system": false,
"id": "users_avatar",
"name": "avatar",
"type": "file",
"required": false,
"presentable": false,
"unique": false,
"options": {
"mimeTypes": [
"image/jpeg",
"image/png",
"image/svg+xml",
"image/gif",
"image/webp"
],
"thumbs": null,
"maxSelect": 1,
"maxSize": 5242880,
"protected": false
}
}
],
"indexes": [],
"listRule": "id = @request.auth.id",
"viewRule": "id = @request.auth.id",
"createRule": "",
"updateRule": "id = @request.auth.id",
"deleteRule": "id = @request.auth.id",
"options": {
"allowEmailAuth": true,
"allowOAuth2Auth": true,
"allowUsernameAuth": true,
"exceptEmailDomains": null,
"manageRule": null,
"minPasswordLength": 8,
"onlyEmailDomains": null,
"onlyVerified": false,
"requireEmail": false
}
},
{
"id": "okcdl5ouza7wpmh",
"name": "POI",
"type": "base",
"system": false,
"schema": [
{
"system": false,
"id": "tizn7ekv",
"name": "Poi",
"type": "json",
"required": true,
"presentable": false,
"unique": false,
"options": {
"maxSize": 2000000
}
},
{
"system": false,
"id": "sknwezy1",
"name": "Poi_id",
"type": "text",
"required": true,
"presentable": false,
"unique": false,
"options": {
"min": null,
"max": null,
"pattern": ""
}
}
],
"indexes": [
"CREATE UNIQUE INDEX `idx_iGYiVpo` ON `POI` (`Poi_id`)"
],
"listRule": "@request.auth.id != \"\"",
"viewRule": "@request.auth.id != \"\"",
"createRule": "(@request.auth.id != \"\")",
"updateRule": null,
"deleteRule": null,
"options": {}
},
{
"id": "iqpfqlcao9so0mj",
"name": "user_poi",
"type": "base",
"system": false,
"schema": [
{
"system": false,
"id": "skjq9wtr",
"name": "owner",
"type": "relation",
"required": false,
"presentable": false,
"unique": false,
"options": {
"collectionId": "_pb_users_auth_",
"cascadeDelete": false,
"minSelect": null,
"maxSelect": 1,
"displayFields": null
}
},
{
"system": false,
"id": "buw92nch",
"name": "poi_list",
"type": "relation",
"required": false,
"presentable": false,
"unique": false,
"options": {
"collectionId": "okcdl5ouza7wpmh",
"cascadeDelete": false,
"minSelect": null,
"maxSelect": 1,
"displayFields": null
}
}
],
"indexes": [
"CREATE UNIQUE INDEX `idx_PC3A5Pg` ON `user_poi` (\n `owner`,\n `poi_list`\n)"
],
"listRule": "",
"viewRule": "",
"createRule": "",
"updateRule": null,
"deleteRule": "",
"options": {}
}
]

View File

@ -2,18 +2,3 @@ Original repo : https://git.lab-ouest.org/Epitech/ratrapage_T-WEB
Submodule repo : https://git.lab-ouest.org/Epitech/fork-open-data-tourism/ Submodule repo : https://git.lab-ouest.org/Epitech/fork-open-data-tourism/
# Prod link :
JSDocs : https://drink-tweb.docs.cb85.fr/
Swagger : https://drink-tweb.cb85.fr/api-docs/
PB : https://pb-tweb.cb85.fr/
Datatourisme :
- https://datatour-tweb.cb85.fr/
- https://datatour-tweb.cb85.fr/graphiql
- https://datatour-tweb.cb85.fr/voyager

View File

@ -1,18 +0,0 @@
{
"folders": [
{
"name": "Ratrapage_WEB",
"path": "."
},
{
"name": "barAndCafe",
"path": "Express/barAndCafe"
},
{
"path": "front"
}
],
"settings": {
"typescript.tsdk": "node_modules/typescript/lib"
}
}

View File

@ -1,8 +1,4 @@
vars { vars {
EXPRESS_API: https://drink-tweb.cb85.fr EXPRESS_API: https://drink-tweb.cb85.fr
PB_URL: https://pb-tweb.cb85.fr OTM_KEY: 5ae2e3f221c38a28845f05b6494c021573d9608a4d749ce8af625e0f
TRIPMAP_URL: https://api.opentripmap.com/0.1/
} }
vars:secret [
OTM_KEY
]

View File

@ -1,18 +0,0 @@
meta {
name: connexion
type: http
seq: 1
}
post {
url: {{PB_URL}}/api/collections/users/auth-with-password
body: json
auth: none
}
body:json {
{
"identity": "michel.biche@aptatio.com",
"password": "123456789"
}
}

View File

@ -1,27 +0,0 @@
meta {
name: get all poi
type: http
seq: 5
}
get {
url: {{PB_URL}}/api/collections/user_poi/records?filter=owner='vvy93m1hoaeshwy'&&poi_list='cabkkovmjsfoapa'
body: json
auth: bearer
}
query {
filter: owner
poi_list: 'cabkkovmjsfoapa'
}
auth:bearer {
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb2xsZWN0aW9uSWQiOiJfcGJfdXNlcnNfYXV0aF8iLCJleHAiOjE3MTg4Mjg0NzEsImlkIjoidnZ5OTNtMWhvYWVzaHd5IiwidHlwZSI6ImF1dGhSZWNvcmQifQ.pC7u-QaZ_BYqWA5wG8wu1lRbbd4mKuKeAveWe_IBnfU
}
body:json {
{
"owner": "vvy93m1hoaeshwy",
"poi_list": "sh430u0im37cxm5"
}
}

View File

@ -1,22 +0,0 @@
meta {
name: link user to poi
type: http
seq: 3
}
post {
url: {{PB_URL}}/api/collections/user_poi/records
body: json
auth: bearer
}
auth:bearer {
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb2xsZWN0aW9uSWQiOiJfcGJfdXNlcnNfYXV0aF8iLCJleHAiOjE3MTg4Mjg0NzEsImlkIjoidnZ5OTNtMWhvYWVzaHd5IiwidHlwZSI6ImF1dGhSZWNvcmQifQ.pC7u-QaZ_BYqWA5wG8wu1lRbbd4mKuKeAveWe_IBnfU
}
body:json {
{
"owner": "vvy93m1hoaeshwy",
"poi_list": "sh430u0im37cxm5"
}
}

View File

@ -1,40 +0,0 @@
meta {
name: send a poi
type: http
seq: 2
}
post {
url: {{PB_URL}}/api/collections/POI/records
body: json
auth: bearer
}
auth:bearer {
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb2xsZWN0aW9uSWQiOiJfcGJfdXNlcnNfYXV0aF8iLCJleHAiOjE3MTg4Mjg0NzEsImlkIjoidnZ5OTNtMWhvYWVzaHd5IiwidHlwZSI6ImF1dGhSZWNvcmQifQ.pC7u-QaZ_BYqWA5wG8wu1lRbbd4mKuKeAveWe_IBnfU
}
body:json {
{
"Poi_id": "11472887",
"Poi": {
"type": "Feature",
"id": "11472887",
"geometry": {
"type": "Point",
"coordinates": [
-0.0626024,
51.4924088
]
},
"properties": {
"xid": "W544344833",
"name": "The Blue Anchor",
"rate": 2,
"osm": "way/544344833",
"wikidata": "Q7718716",
"kinds": "pubs,foods,shops,marketplaces,tourist_facilities"
}
}
}
}

View File

@ -1,37 +0,0 @@
meta {
name: send fav to astro
type: http
seq: 4
}
post {
url: http://localhost:3000/maps/save_poi
body: json
auth: bearer
}
auth:bearer {
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb2xsZWN0aW9uSWQiOiJfcGJfdXNlcnNfYXV0aF8iLCJleHAiOjE3MTg4ODY2OTIsImlkIjoidnZ5OTNtMWhvYWVzaHd5IiwidHlwZSI6ImF1dGhSZWNvcmQifQ.R9PBGlHn6aBHt89g6G0NykMh_Vye24OpKEUYtz6R6Og
}
body:json {
{
"type": "Feature",
"id": "11472888",
"geometry": {
"type": "Point",
"coordinates": [
-0.0626024,
51.4924088
]
},
"properties": {
"xid": "W544344833",
"name": "The Blue Anchor",
"rate": 2,
"osm": "way/544344833",
"wikidata": "Q7718716",
"kinds": "pubs,foods,shops,marketplaces,tourist_facilities"
}
}
}

View File

@ -1,7 +1,7 @@
--- ---
import type { Input as Props } from 'types'; import type { Input as Props } from 'types';
const {value, checked ,name, label, autocomplete, placeholder, divClass, inputClass} = Astro.props; const { checked ,name, label, autocomplete, placeholder, divClass, inputClass} = Astro.props;
--- ---
@ -14,7 +14,6 @@ const {value, checked ,name, label, autocomplete, placeholder, divClass, inputCl
name={name} name={name}
id={name} id={name}
checked={checked} checked={checked}
value={value}
autocomplete={autocomplete} autocomplete={autocomplete}
placeholder={placeholder} placeholder={placeholder}
class={"mr-2 size-5 " + inputClass} class={"mr-2 size-5 " + inputClass}

View File

@ -3,16 +3,119 @@ import { getPermalink, getBlogPermalink } from './utils/permalinks'
export const headerData = { export const headerData = {
links: [ links: [
{ {
text: 'Explorer POI', text: 'Homes',
href: '/maps', links: [
{
text: 'SaaS',
href: getPermalink('/homes/saas'),
}, },
{ {
text: 'itinéraire', text: 'Startup',
href: '/maps/find_route', href: getPermalink('/homes/startup'),
}, },
{ {
text: 'Compte', text: 'Mobile App',
href: '/account', href: getPermalink('/homes/mobile-app'),
},
{
text: 'Personal',
href: getPermalink('/homes/personal'),
},
],
},
{
text: 'Pages',
links: [
{
text: 'Features (Anchor Link)',
href: getPermalink('/#features'),
},
{
text: 'Services',
href: getPermalink('/services'),
},
{
text: 'Pricing',
href: getPermalink('/pricing'),
},
{
text: 'About us',
href: getPermalink('/about'),
},
{
text: 'Contact',
href: getPermalink('/contact'),
},
{
text: 'Terms',
href: getPermalink('/terms'),
},
{
text: 'Privacy policy',
href: getPermalink('/privacy'),
},
],
},
{
text: 'Landing',
links: [
{
text: 'Lead Generation',
href: getPermalink('/landing/lead-generation'),
},
{
text: 'Long-form Sales',
href: getPermalink('/landing/sales'),
},
{
text: 'Click-Through',
href: getPermalink('/landing/click-through'),
},
{
text: 'Product Details (or Services)',
href: getPermalink('/landing/product'),
},
{
text: 'Coming Soon or Pre-Launch',
href: getPermalink('/landing/pre-launch'),
},
{
text: 'Subscription',
href: getPermalink('/landing/subscription'),
},
],
},
{
text: 'Blog',
links: [
{
text: 'Blog List',
href: getBlogPermalink(),
},
{
text: 'Article',
href: getPermalink(
'get-started-website-with-astro-tailwind-css',
'post'
),
},
{
text: 'Article (with MDX)',
href: getPermalink('markdown-elements-demo-post', 'post'),
},
{
text: 'Category Page',
href: getPermalink('tutorials', 'category'),
},
{
text: 'Tag Page',
href: getPermalink('astro', 'tag'),
},
],
},
{
text: 'Widgets',
href: '#',
}, },
], ],
// actions: [ // actions: [

View File

@ -14,16 +14,18 @@ const metadata = {
<Layout metadata={metadata}> <Layout metadata={metadata}>
<div class="h-[calc(100vh-5rem)] flex flex-col"> <div class="h-[calc(100vh-16rem)] flex flex-col">
<div class="w-full h-96 grow" id="map" /> <div class="w-full h-96 grow" id="map" />
<Button id="test-btn">test</Button> <Button id="test-btn">test</Button>
</div> </div>
<!-- TODO: faire en sort que le style soit propre -->
<!-- for remouve footer --> <!-- for remouve footer -->
<div slot="footer"></div> <!-- <div slot="footer"></div> -->
<!-- penser a rm 11 au rem au dessus pour la taille -->
</Layout> </Layout>
<script> <script>
import * as L from 'leaflet' import L from 'leaflet'
import markerShadow from "leaflet/dist/images/marker-shadow.png" import markerShadow from "leaflet/dist/images/marker-shadow.png"
import markerIcon from "leaflet/dist/images/marker-icon.png" import markerIcon from "leaflet/dist/images/marker-icon.png"
import 'leaflet-routing-machine/dist/leaflet-routing-machine.js' import 'leaflet-routing-machine/dist/leaflet-routing-machine.js'
@ -55,9 +57,7 @@ const metadata = {
// L.latLng(47.218536, -1.554075) // L.latLng(47.218536, -1.554075)
// ], // ],
routeWhileDragging: true, routeWhileDragging: true,
//@ts-ignore
geocoder: L.Control.Geocoder.nominatim(), geocoder: L.Control.Geocoder.nominatim(),
//@ts-ignore
position: 'topleft', position: 'topleft',
showAlternatives: true, showAlternatives: true,
reverseWaypoints: true, reverseWaypoints: true,

View File

@ -4,42 +4,20 @@ import 'leaflet/dist/leaflet.css'
import 'leaflet-geosearch/dist/geosearch.css' import 'leaflet-geosearch/dist/geosearch.css'
import CheckBox from 'components/CheckBox.astro' import CheckBox from 'components/CheckBox.astro'
import Radios from 'components/Radios.astro' import Radios from 'components/Radios.astro'
import ListResult, { type RecordModel } from 'pocketbase'
import { Expand, Trash } from 'lucide-astro'
const pb = Astro.locals.pb
const connected = pb.authStore.isValid
const metadata = { const metadata = {
title: 'Maps', title: 'Maps',
ignoreTitleTemplate: true, ignoreTitleTemplate: true,
} }
let fav = new Array<any>
if(connected){
try {
const request = await pb.collection('user_poi').getList(1,10,{filter:`owner="${pb.authStore.model!.id}"`, expand:"poi_list"})
request.items.forEach(element => {
fav.push(element.expand!.poi_list.Poi)
});
} catch (error) {
console.log(error);
}
}
console.log(fav);
--- ---
<Layout metadata={metadata}> <Layout metadata={metadata}>
<div class="h-[calc(100vh-5rem)] flex flex-row"> <div class="h-[calc(100vh-16rem)] flex flex-row">
<div class="w-1/5 flex flex-col"> <div class="w-1/5 flex flex-col">
<p id="message" class="hidden text-center mb-3">pouet</p> <p id="message" class="hidden text-center mb-3">pouet</p>
<p class="text-center text-2xl mb-3">Filtre :</p> <p class="text-center text-2xl mb-3">Filtre :</p>
<div class=""> <div class="grow">
<p>note minimal :</p> <p>note minimal :</p>
<Radios <Radios
values={[ values={[
@ -54,40 +32,27 @@ console.log(fav);
<p class="text-center text-xl mb-3">Type POI :</p> <p class="text-center text-xl mb-3">Type POI :</p>
<CheckBox <CheckBox
label="Bar, Pub, Café,..." label="Bar, Pub, Café,..."
name="filter" name="drink"
value="drink"
checked checked
/> />
</div> </div>
<div class="mb-3 grow"> <div class="mb-3">
<p class="text-center text-xl mb-3">Source :</p> <p class="text-center text-xl mb-3">Source :</p>
<CheckBox <CheckBox
label="Open Trip Maps" label="Open Trip Maps"
name="filter" name="otm"
value="otm"
checked checked
/> />
</div> </div>
{connected && (
<div class="mb-2">
<p class="text-center text-xl mb-3">Favori :</p>
{fav.map(val =>(
<div class="ml-2 flex flex-row mb-1" id="fav-div">
<p class="grow poi-favori" id={val.id} data-pos={val.geometry.coordinates}>{val.properties.name}</p>
<Trash id={val.id} class="poi-trash"/>
</div> </div>
))} <div class="flex flex-col grow">
</div> <div class="w-full h-96 grow" id="map" />
)}
</div>
<div class="flex flex-col h-full grow">
<div class="w-full h-full grow" id="map" />
</div> </div>
</div> </div>
<!-- TODO: faire en sort que le style soit propre --> <!-- TODO: faire en sort que le style soit propre -->
<!-- for remouve footer --> <!-- for remouve footer -->
<div slot="footer"></div> <!-- <div slot="footer"></div> -->
<!-- penser a rm 11 au rem au dessus pour la taille --> <!-- penser a rm 11 au rem au dessus pour la taille -->
</Layout> </Layout>
@ -98,14 +63,9 @@ console.log(fav);
import { OpenStreetMapProvider } from 'leaflet-geosearch' import { OpenStreetMapProvider } from 'leaflet-geosearch'
import { GeoSearchControl } from 'leaflet-geosearch' import { GeoSearchControl } from 'leaflet-geosearch'
const showFav = document.querySelectorAll(".poi-favori")
const trashFav = document.querySelectorAll(".poi-trash")
const favDiv = document.querySelector('#fav-div')
const icon = {icon: new L.Icon({iconUrl: markerIcon.src, shadowUrl: markerShadow.src, iconAnchor: [13,41]})} const icon = {icon: new L.Icon({iconUrl: markerIcon.src, shadowUrl: markerShadow.src, iconAnchor: [13,41]})}
// const BACK_URL = "http://localhost:3001/" //XXX : mettre url de prod const BACK_URL = "http://localhost:3001/" //XXX : mettre url de prod
const BACK_URL = "https://drink-tweb.cb85.fr/" //XXX : mettre url de prod
// declare map // declare map
const map = L.map('map', { const map = L.map('map', {
@ -135,39 +95,6 @@ console.log(fav);
}), }),
) )
async function saveToFav(element: any, save: boolean){
const url = '/maps/save_poi';
const options = {
method: 'POST',
body: JSON.stringify({Poi : element, save: save})
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
}
function eventGotoFav(e: Element){
e.addEventListener('click', () =>{
const pose = e.getAttribute('data-pos')?.split(',')
map.panTo(new L.LatLng(parseFloat(pose![1]),parseFloat(pose![0])))
})
}
function eventRemoveFav(e: Element){
e.addEventListener('click', async () => {
await saveToFav({id:e.id, type:"Feature"},false)
document.location.reload()
})
}
showFav.forEach(e => {eventGotoFav(e)})
trashFav.forEach(e => {eventRemoveFav(e)})
let poiMarkers = new Array<L.Marker> let poiMarkers = new Array<L.Marker>
let minimalNote = "1" let minimalNote = "1"
let drink = true let drink = true
@ -186,7 +113,7 @@ console.log(fav);
params.append("rate", minimalNote) params.append("rate", minimalNote)
if(drink && otm){ if(drink && otm){
fetch(`${BACK_URL}otm/box?${params.toString()}`,{method: 'GET',headers: {'Content-Type': 'application/json',}}).then(function (response) { fetch(`${BACK_URL}otm/box?${params.toString()}`,{method: 'GET',headers: {'Content-Type': 'application/json'}}).then(function (response) {
return response.json() return response.json()
}).then(function (data) { }).then(function (data) {
poiMarkers.forEach(element => { poiMarkers.forEach(element => {
@ -201,16 +128,7 @@ console.log(fav);
tags += "- " + element + "<br/>" tags += "- " + element + "<br/>"
}) })
const poiMarker = L.marker([element.geometry.coordinates[1],element.geometry.coordinates[0]],icon) const poiMarker = L.marker([element.geometry.coordinates[1],element.geometry.coordinates[0]],icon)
.bindPopup(`<b>${prop.name}</b><br/>note : ${prop.rate} <br/>tags:<br/> ${tags} <p>favori : <input type="checkbox" name="like" id=${element.id}/><p>`) .bindPopup(`<b>${prop.name}</b><br/>note : ${prop.rate} <br/>tags:<br/> ${tags}`)
.on("click", () => {
document.querySelectorAll<HTMLInputElement>('input[name="like"]').forEach(e => {
e.addEventListener("click", async () => {
console.log(element)
await saveToFav(element, e.checked)
document.location.reload()
})
})
})
poiMarker.addTo(map) poiMarker.addTo(map)
poiMarkers.push(poiMarker) poiMarkers.push(poiMarker)
}) })
@ -231,7 +149,7 @@ console.log(fav);
} }
} }
// envent pour lancer la recherche // envent pour lancer la recherche
const cooldown = 400 const cooldown = 1000
sender() sender()
let timeoutHandle = window.setTimeout(sender, cooldown) let timeoutHandle = window.setTimeout(sender, cooldown)
@ -250,9 +168,9 @@ console.log(fav);
} }
}) })
document.querySelectorAll<HTMLInputElement>("input[name='filter']").forEach(e =>{ document.querySelectorAll<HTMLInputElement>("input[type='checkbox']").forEach(e =>{
e.addEventListener("click", () => { e.addEventListener("click", () => {
switch (e.value) { switch (e.name) {
case "drink": case "drink":
drink = e.checked drink = e.checked
break; break;
@ -277,5 +195,4 @@ console.log(fav);
searchBox() searchBox()
}) })
}) })
</script> </script>

View File

@ -1,47 +0,0 @@
---
import AstroUtils from "libs/AstroUtils";
import type { RecordModel } from "pocketbase";
const pb = Astro.locals.pb
if(!pb.authStore.isValid){
return Astro.redirect("/account")
}
await AstroUtils.wrap(async () => {
if (Astro.request.method !== 'POST') {
return
}
const poiJson = await Astro.request.json()
const data = {Poi: poiJson.Poi, Poi_id:poiJson.Poi.id}
let record: RecordModel
try {
record = await pb.collection('POI').create(data);
} catch (error) {
try{
record = await pb.collection('POI').getFirstListItem(`Poi_id="${poiJson.Poi.id}"`)
} catch (error2) {
console.log("error 1 :")
console.log(error)
console.log("error 2 :")
console.log(error2)
}
}
try {
if(poiJson.save){
await pb.collection('user_poi').create({owner: pb.authStore.model!.id, poi_list:record!.id})
}else{
record = await pb.collection('user_poi').getFirstListItem(`poi_list="${record!.id}"&&owner="${pb.authStore.model!.id}"`)
await pb.collection('user_poi').delete(record.id)
}
} catch (error) {
console.log(error)
}
})
---

View File

@ -162,7 +162,7 @@ export interface Testimonial {
} }
export interface Input { export interface Input {
type?: HTMLInputTypeAttribute type: HTMLInputTypeAttribute
name: string name: string
label?: string label?: string
autocomplete?: string autocomplete?: string
@ -170,7 +170,6 @@ export interface Input {
divClass?: string divClass?: string
inputClass?: string inputClass?: string
checked?: bool checked?: bool
value?:string
} }
export interface Textarea { export interface Textarea {