16 Commits

Author SHA1 Message Date
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 186 additions and 68 deletions

View File

@ -8,6 +8,7 @@
"@types/express": "^4.17.21", "@types/express": "^4.17.21",
"@types/node": "^20.12.7", "@types/node": "^20.12.7",
"axios": "^1.6.8", "axios": "^1.6.8",
"cors": "^2.8.5",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"express": "^4.19.2", "express": "^4.19.2",
"rimraf": "^5.0.5", "rimraf": "^5.0.5",
@ -15,6 +16,7 @@
"swagger-ui-express": "^5.0.0" "swagger-ui-express": "^5.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/cors": "^2.8.17",
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/rewire": "^2.5.30", "@types/rewire": "^2.5.30",
"@types/supertest": "^6.0.2", "@types/supertest": "^6.0.2",
@ -1968,6 +1970,15 @@
"integrity": "sha512-he+DHOWReW0nghN24E1WUqM0efK4kI9oTqDm6XmK8ZPe2djZ90BSNdGnIyCLzCPw7/pogPlGbzI2wHGGmi4O/Q==", "integrity": "sha512-he+DHOWReW0nghN24E1WUqM0efK4kI9oTqDm6XmK8ZPe2djZ90BSNdGnIyCLzCPw7/pogPlGbzI2wHGGmi4O/Q==",
"dev": true "dev": true
}, },
"node_modules/@types/cors": {
"version": "2.8.17",
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.17.tgz",
"integrity": "sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/express": { "node_modules/@types/express": {
"version": "4.17.21", "version": "4.17.21",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz",
@ -4745,6 +4756,18 @@
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"node_modules/cors": {
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
"dependencies": {
"object-assign": "^4",
"vary": "^1"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/create-jest": { "node_modules/create-jest": {
"version": "29.7.0", "version": "29.7.0",
"resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz",
@ -9248,7 +9271,6 @@
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
"dev": true,
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
} }

View File

@ -14,6 +14,7 @@
"@types/express": "^4.17.21", "@types/express": "^4.17.21",
"@types/node": "^20.12.7", "@types/node": "^20.12.7",
"axios": "^1.6.8", "axios": "^1.6.8",
"cors": "^2.8.5",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"express": "^4.19.2", "express": "^4.19.2",
"rimraf": "^5.0.5", "rimraf": "^5.0.5",
@ -21,6 +22,7 @@
"swagger-ui-express": "^5.0.0" "swagger-ui-express": "^5.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/cors": "^2.8.17",
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/rewire": "^2.5.30", "@types/rewire": "^2.5.30",
"@types/supertest": "^6.0.2", "@types/supertest": "^6.0.2",

View File

@ -1,11 +1,13 @@
import { getCity, getRadius, getPoiId, getBox } from "./openTripMaps" import { getCity, getRadius, getPoiId, getBox } from "./openTripMaps"
import express from "express" import express from "express"
import cors from "cors"
/** /**
* Initialize Express application instance. * Initialize Express application instance.
* @returns An initialized Express application object. * @returns An initialized Express application object.
*/ */
const app = express() const app = express()
app.use(cors())
/** /**

View File

@ -135,8 +135,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').

View File

@ -1,5 +1,6 @@
vars { vars {
TRIPMAP_URL: https://api.opentripmap.com/0.1 TRIPMAP_URL: https://api.opentripmap.com/0.1
EXPRESS_API: http://localhost:3001
} }
vars:secret [ vars:secret [
app_key, app_key,

View File

@ -0,0 +1,3 @@
vars {
EXPRESS_API: https://drink-tweb.cb85.fr
}

View File

@ -5,7 +5,7 @@ meta {
} }
get { get {
url: http://localhost:3001/otm/city?name=La roche sur yon&radius=300 url: {{EXPRESS_API}}/otm/city?name=La roche sur yon&radius=300
body: none body: none
auth: none auth: none
} }

View File

@ -0,0 +1,16 @@
meta {
name: otm_city
type: http
seq: 5
}
get {
url: {{TRIPMAP_URL}}/en/places/geoname?name=paris&apikey={{OTM_KEY}}
body: none
auth: none
}
query {
name: paris
apikey: {{OTM_KEY}}
}

View File

@ -18,7 +18,9 @@ services:
- public - public
front: front:
image: git.lab-ouest.org/epitech/ratrapage_t-web_front:pr-1-head image: git.lab-ouest.org/epitech/ratrapage_t-web_front:pr-16-head
environment:
- POCKETBASE_URL=https://${POCKET_BASE_URL}
depends_on: depends_on:
- pocketbase - pocketbase
labels: labels:
@ -30,9 +32,10 @@ services:
- public - public
back_drink: back_drink:
image: git.lab-ouest.org/epitech/ratrapage_t-web_back:pr-6-head image: git.lab-ouest.org/epitech/ratrapage_t-web_back:master
environment: environment:
- port=${BACK_BASE_PORT} - port=${BACK_BASE_PORT}
- OPEN_TRIP_MAPS_KEY=${OPEN_TRIP_MAPS_KEY}
labels: labels:
- traefik.enable=true - traefik.enable=true
- traefik.http.routers.expressDrinkTweb.rule=Host(`${DRINK_URL}`) - traefik.http.routers.expressDrinkTweb.rule=Host(`${DRINK_URL}`)

View File

@ -27,6 +27,7 @@ const whenExternalScripts = (items = []) =>
export default defineConfig({ export default defineConfig({
output: 'server',
compressHTML: true, compressHTML: true,
build: { build: {
assets: 'assets', assets: 'assets',
@ -37,7 +38,6 @@ export default defineConfig({
port: 3000 port: 3000
}, },
trailingSlash: 'never', trailingSlash: 'never',
output: 'server',
adapter: node({ adapter: node({
mode: 'standalone' mode: 'standalone'
}), }),

View File

@ -34,7 +34,8 @@
"astro-icon": "^1.1.0", "astro-icon": "^1.1.0",
"limax": "4.1.0", "limax": "4.1.0",
"lodash.merge": "^4.6.2", "lodash.merge": "^4.6.2",
"unpic": "^3.18.0" "unpic": "^3.18.0",
"tailwind-merge": "^2.3.0"
}, },
"devDependencies": { "devDependencies": {
"@astrojs/check": "^0", "@astrojs/check": "^0",
@ -68,7 +69,6 @@
"reading-time": "^1.5.0", "reading-time": "^1.5.0",
"rehype-plugin-image-native-lazy-loading": "^1.2.0", "rehype-plugin-image-native-lazy-loading": "^1.2.0",
"sharp": "0.33.3", "sharp": "0.33.3",
"tailwind-merge": "^2.3.0",
"tailwindcss": "^3.4.3", "tailwindcss": "^3.4.3",
"typescript-eslint": "^7.9.0" "typescript-eslint": "^7.9.0"
} }

View File

@ -0,0 +1,28 @@
---
import type { Input as Props } from 'types';
const { type, name, label, autocomplete, placeholder, divClass, inputClass} = Astro.props;
---
<>
{
name && (
<div class={divClass}>
{label && (
<label for={name} class="block text-sm font-medium">
{label}
</label>
)}
<input
type={type}
name={name}
id={name}
autocomplete={autocomplete}
placeholder={placeholder}
class={"py-3 px-4 block w-full text-md rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-900" + inputClass}
/>
</div>
)
}
</>

View File

@ -1,6 +1,6 @@
site: site:
name: AstroWind name: EpicRoadTrip
site: 'https://astrowind.vercel.app' site: 'https://front-tweb.cb85.fr'
base: '/' base: '/'
trailingSlash: false trailingSlash: false

View File

@ -80,18 +80,4 @@ const metadata = {
]} ]}
/> />
<Oauth/> <Oauth/>
<form id="account-creation" method="post" enctype="multipart/form-data">
<input type="hidden" name="type" value="userPassword">
<input required name="name" placeholder="Prénom Nom"/>
<input required name="username" placeholder="Pseudo"/>
<input required name="email" type="email" placeholder="Renseignez votre email" />
<input required name="password" type="password" placeholder="Créez un mot de passe" />
<input required name="passwordConfirm" type="password" placeholder="Confirmer votre mot de passe" />
<button>Créer un compte</button>
</form>
<button id="OauthDiscord">connexion avec discord</button>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="type" value="discord2FA">
</form>
</Layout> </Layout>

View File

@ -1,31 +1,90 @@
--- ---
import Layout from 'layouts/PageLayout.astro'; import Layout from 'layouts/PageLayout.astro'
import 'leaflet/dist/leaflet.css' import 'leaflet/dist/leaflet.css'
import FormContainer from 'components/ui/Form.astro'
import Input from 'components/Input.astro'
import Button from 'components/ui/Button.astro'
const metadata = { const metadata = {
title: 'Maps', title: 'Maps',
ignoreTitleTemplate: true, ignoreTitleTemplate: true,
}; }
--- ---
<Layout metadata={metadata}> <Layout metadata={metadata}>
<div class="flex flex-row justify-between align-center max-w-xl mx-auto rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-900 shadow p-4 sm:p-6 lg:p-8 w-full">
<Input type='text' name='search' placeholder='Paris' divClass='grow mr-4'/>
<Button variant="primary" id='search-btn' class='grow-4'>rechercher</Button>
</div>
<div class="w-full h-96" id="map" /> <div class="w-full h-96" id="map" />
</Layout> </Layout>
<script> <script>
import L from 'leaflet' import L, { geoJSON, Icon, type LatLngTuple } from 'leaflet'
import markerShadow from "leaflet/dist/images/marker-shadow.png"
import markerIcon from "leaflet/dist/images/marker-icon.png"
const btn = document.querySelector('#search-btn')
const input = document.querySelector<HTMLInputElement>('#search')
const icon = {icon: new L.Icon({iconUrl: markerIcon.src, shadowUrl: markerShadow.src, iconAnchor: [13,41]})}
// const BACK_URL = "https://drink-tweb.cb85.fr/"
const BACK_URL = "http://localhost:3001/"
let mapsCenter : L.LatLngTuple
const map = L.map('map', { const map = L.map('map', {
center: [50,0], center: [51.5, -0.09],
zoom: 13, zoom: 13,
preferCanvas: true preferCanvas: true
}) })
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19, maxZoom: 19,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map); }).addTo(map)
var marker = L.marker([51.5, -0.09]).addTo(map);
let marker = L.marker([51.5, -0.09],icon).addTo(map)
marker.bindPopup("test")
function search() {
const params: URLSearchParams = new URLSearchParams();
params.append("name", input!.value)
fetch(`${BACK_URL}otm/city?${params.toString()}`,{method: 'GET',headers: {'Content-Type': 'application/json'}}).then(function (response) {
// The API call was successful!
return response.json();
}).then(function (data) {
console.log(data);
mapsCenter = [data.lat, data.lon]
marker.setLatLng(mapsCenter)
map.setView(mapsCenter)
data.features.forEach(element => {
console.log(element)
const poiMarker = L.marker([element.geometry.coordinates[1],element.geometry.coordinates[0]],icon).bindPopup(element.properties)
poiMarker.addTo(map)
});
}).catch(function (err) {
console.warn('Something went wrong.', err);
});
}
btn?.addEventListener('click',search)
input?.addEventListener('keypress',(e) =>{
if(e.key == 'Enter'){
search()
}
})
// marker.setLatLng(mapsCenter)
// map.setView(mapsCenter)
// const mark2 = map.getBounds().getNorthWest()
// const mark3 = map.getBounds().getSouthEast()
// let marker2 = L.marker(mark2,icon).addTo(map)
// let marker3 = L.marker(mark3,icon).addTo(map)
</script> </script>

View File

@ -1,5 +1,5 @@
import type { AstroComponentFactory } from 'astro/runtime/server/index.js' import type { AstroComponentFactory } from 'astro/runtime/server/index.js'
import type { HTMLAttributes, ImageMetadata } from 'astro/types' import type { HTMLAttributes, ImageMetadata, HTMLInputTypeAttribute } from 'astro/types'
export interface Post { export interface Post {
/** A unique ID number that identifies a post. */ /** A unique ID number that identifies a post. */
@ -26,7 +26,7 @@ export interface Post {
/** */ /** */
category?: Taxonomy category?: Taxonomy
/** */ /** */
tags?: Taxonomy[] tags?: Array<Taxonomy>
/** */ /** */
author?: string author?: string
@ -167,6 +167,8 @@ export interface Input {
label?: string label?: string
autocomplete?: string autocomplete?: string
placeholder?: string placeholder?: string
divClass?: string
inputClass?: string
} }
export interface Textarea { export interface Textarea {

View File

@ -1,5 +1,5 @@
import defaultTheme from 'tailwindcss/defaultTheme'; import defaultTheme from 'tailwindcss/defaultTheme'
import typographyPlugin from '@tailwindcss/typography'; import typographyPlugin from '@tailwindcss/typography'
module.exports = { module.exports = {
content: ['./src/**/*.{astro,html,js,jsx,json,md,mdx,svelte,ts,tsx,vue}'], content: ['./src/**/*.{astro,html,js,jsx,json,md,mdx,svelte,ts,tsx,vue}'],
@ -21,4 +21,5 @@ module.exports = {
}, },
plugins: [typographyPlugin], plugins: [typographyPlugin],
darkMode: 'class', darkMode: 'class',
}; }

View File

@ -1,8 +0,0 @@
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
theme: {
extend: {},
},
plugins: [],
}