Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Styling
Browse files Browse the repository at this point in the history
  • Loading branch information
matheus motizuki authored and matheus motizuki committed Oct 8, 2023
1 parent 99d561b commit baabb0c
Show file tree
Hide file tree
Showing 16 changed files with 192 additions and 12 deletions.
1 change: 1 addition & 0 deletions hackathon_front
Submodule hackathon_front added at e70029
2 changes: 1 addition & 1 deletion src/lib/components/IntroductionSection.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</a>
</div>
</div>
<div class="hidden lg:mt-0 lg:col-span-5 lg:flex">
<div class="hidden lg:mt-0 lg:col-span-5 lg:flex justify-end">
<div class="max-w-sm bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700 hover:shadow-lg">
<a href="/404" class="hover:shadow-lg">
<img class="rounded-t-lg" src="/src/lib/assets/image1.jpg" alt="" />
Expand Down
13 changes: 7 additions & 6 deletions src/lib/components/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,19 @@
</li>
<li>
<a href="#" on:click={() => dashboardSelected.set('List')} class="flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-200 dark:hover:bg-gray-700 group">
<svg class="flex-shrink-0 text-violet-600 transition duration-75 dark:text-gray-400 group-hover:text-violet-900 dark:group-hover:text-white" xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 48 48"><mask id="ipSNotebook0"><g fill="none" stroke-linejoin="round" stroke-width="4"><path fill="#fff" stroke="#fff" d="M10 6a2 2 0 0 1 2-2h28a2 2 0 0 1 2 2v36a2 2 0 0 1-2 2H12a2 2 0 0 1-2-2V6Z"/><path stroke="#000" stroke-linecap="round" d="M34 6v36"/>
<path stroke="#fff" stroke-linecap="round" d="M6 14h8M6 24h8M6 34h8M27 4h12M27 44h12"/></g></mask><path fill="currentColor" d="M0 0h48v48H0z" mask="url(#ipSNotebook0)"/>
<svg class="flex-shrink-0 text-violet-600 transition duration-75 dark:text-gray-400 group-hover:text-violet-900 dark:group-hover:text-white" xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 24 24">
<path fill="currentColor" d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4s-4 1.79-4 4s1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/>
</svg>
<span class="flex-1 ml-3 whitespace-nowrap indent-0.5">Perfil</span>
<span class="flex-1 ml-3 whitespace-nowrap indent-0">Perfil</span>
</a>
</li>
<li>
<a href="#" on:click={() => dashboardSelected.set('List')} class="flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-200 dark:hover:bg-gray-700 group">
<svg class="flex-shrink-0 text-violet-600 transition duration-75 dark:text-gray-400 group-hover:text-violet-900 dark:group-hover:text-white" xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 48 48"><mask id="ipSNotebook0"><g fill="none" stroke-linejoin="round" stroke-width="4"><path fill="#fff" stroke="#fff" d="M10 6a2 2 0 0 1 2-2h28a2 2 0 0 1 2 2v36a2 2 0 0 1-2 2H12a2 2 0 0 1-2-2V6Z"/><path stroke="#000" stroke-linecap="round" d="M34 6v36"/>
<path stroke="#fff" stroke-linecap="round" d="M6 14h8M6 24h8M6 34h8M27 4h12M27 44h12"/></g></mask><path fill="currentColor" d="M0 0h48v48H0z" mask="url(#ipSNotebook0)"/>
<svg class="flex-shrink-0 text-violet-600 transition duration-75 dark:text-gray-400 group-hover:text-violet-900 dark:group-hover:text-white" xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 36 36">
<path fill="currentColor" d="m32.57 15.72l-3.35-1a11.65 11.65 0 0 0-.95-2.33l1.64-3.07a.61.61 0 0 0-.11-.72l-2.39-2.4a.61.61 0 0 0-.72-.11l-3.05 1.63a11.62 11.62 0 0 0-2.36-1l-1-3.31a.61.61 0 0 0-.59-.41h-3.38a.61.61 0 0 0-.58.43l-1 3.3a11.63 11.63 0 0 0-2.38 1l-3-1.62a.61.61 0 0 0-.72.11L6.2 8.59a.61.61 0 0 0-.11.72l1.62 3a11.63 11.63 0 0 0-1 2.37l-3.31 1a.61.61 0 0 0-.43.58v3.38a.61.61 0 0 0 .43.58l3.33 1a11.62 11.62 0 0 0 1 2.33l-1.64 3.14a.61.61 0 0 0 .11.72l2.39 2.39a.61.61 0 0 0 .72.11l3.09-1.65a11.65 11.65 0 0 0 2.3.94l1 3.37a.61.61 0 0 0 .58.43h3.38a.61.61 0 0 0 .58-.43l1-3.38a11.63 11.63 0 0 0 2.28-.94l3.11 1.66a.61.61 0 0 0 .72-.11l2.39-2.39a.61.61 0 0 0 .11-.72l-1.66-3.1a11.63 11.63 0 0 0 .95-2.29l3.37-1a.61.61 0 0 0 .43-.58v-3.41a.61.61 0 0 0-.37-.59ZM18 23.5a5.5 5.5 0 1 1 5.5-5.5a5.5 5.5 0 0 1-5.5 5.5Z" class="clr-i-solid clr-i-solid-path-1"/>
<path fill="none" d="M0 0h36v36H0z"/>
</svg>
<span class="flex-1 ml-3 whitespace-nowrap indent-0.5">Configurações</span>
<span class="flex-1 ml-3 whitespace-nowrap indent-0">Configurações</span>
</a>
</li>
<li>
Expand Down
5 changes: 0 additions & 5 deletions src/routes/contact/+page.svelte

This file was deleted.

49 changes: 49 additions & 0 deletions src/routes/dashboard/+page.server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import {get} from "svelte/store";
import {userStore} from "../../stores.js";
import axios from "axios";
import {backendUrl} from "$lib/server/constants.js";
import {redirect} from "@sveltejs/kit";

export async function load({ params }) {
const user = get(userStore);

async function getSchools() {
let config = {
method: 'get',
maxBodyLength: Infinity,
url: backendUrl + 'school/distance/' + user.Id + '?distance=100',
headers: {
'Authorization': 'Bearer ' + user.token,
'Content-Type': 'application/json'
},
};

let result = await axios.request(config).catch((error) => {
throw redirect(302, "/logout")
});

return result.data;
}
async function getUserCoords() {
let config = {
method: 'get',
maxBodyLength: Infinity,
url: backendUrl + 'users/' + user.Id,
headers: {
'Authorization': 'Bearer ' + user.token,
'Content-Type': 'application/json'
},
};

let result = await axios.request(config).catch((error) => {
throw redirect(302, "/logout")
});

return { latitude: result.data.latitude, longitude: result.data.longitude}
}

return {
userCoords: getUserCoords(),
schools: getSchools()
}
}
20 changes: 20 additions & 0 deletions src/routes/dashboard/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<script>
import Map from "$lib/components/Map.svelte"
import Sidebar from "$lib/components/Sidebar.svelte";
import {dashboardSelected} from "../../stores.js";
import ContactGrid from "$lib/components/ContactGrid.svelte";
export let data;
</script>

<Sidebar>
<span slot="main">
{#if $dashboardSelected === 'Maps'}
<Map userCoords={data.userCoords} schools={data.schools}/>
{/if}
{#if $dashboardSelected === 'List'}
<ContactGrid/>
{/if}
</span>
</Sidebar>
37 changes: 37 additions & 0 deletions src/routes/login/+page.server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import axios from "axios";
import {userStore} from "../../stores.js";
import {redirect} from "@sveltejs/kit";
import {backendUrl} from "$lib/server/constants.js";

export const actions = {
default: async ({ request }) => {
const formData = await request.formData();
const email = formData.get('email');
const password = formData.get('password')

let config = {
method: 'post',
maxBodyLength: Infinity,
url: backendUrl + 'auth/login',
headers: {
'Content-Type': 'application/json'
},
data : JSON.stringify({
email: email,
password: password
})
};

let user = await axios.request(config).catch((error) => {
console.log(error.message)
return { success: false, error: error.message}
})

if (user?.data) {
userStore.set(user.data);
throw redirect(302, '/dashboard')
}

return { success: false, error: "Credenciais Invalidas"}
},
};
5 changes: 5 additions & 0 deletions src/routes/login/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
import LoginPage from "$lib/components/LoginPage.svelte";
</script>

<LoginPage/>
7 changes: 7 additions & 0 deletions src/routes/logout/+server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {userStore} from "../../stores.js";
import {redirect} from "@sveltejs/kit";

export function GET({ url }) {
userStore.set({})
throw redirect(302, "/")
}
44 changes: 44 additions & 0 deletions src/routes/register/+page.server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import axios from "axios";
import {userStore} from "../../stores.js";
import {redirect} from "@sveltejs/kit";
import {backendUrl} from "$lib/server/constants.js";

export const actions = {
default: async ({ request }) => {
const formData = await request.formData();

const name = formData.get('name');
const email = formData.get('email')
const password = formData.get('password')
const cep = formData.get('cep')
const phoneNumber = formData.get('phone-number')

let config = {
method: 'post',
maxBodyLength: Infinity,
url: backendUrl + 'auth/register',
headers: {
'Content-Type': 'application/json'
},
data : JSON.stringify({
name: name,
email: email,
password: password,
cep: cep,
phoneNumber: phoneNumber
})
};

let user = await axios.request(config).catch((error) => {
console.log(error.message)
return { success: false, error: error.message}
})

if (user?.data) {
userStore.set(user.data);
throw redirect(302, '/dashboard')
}


},
};
5 changes: 5 additions & 0 deletions src/routes/register/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
import RegisterPage from "$lib/components/RegisterPage.svelte";
</script>

<RegisterPage/>
1 change: 1 addition & 0 deletions src/routes/school/+layout.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export function load({ params }) {

if (user.token && user.type !== 'school') throw redirect(302, '/school/login')
}

5 changes: 5 additions & 0 deletions src/routes/school/login/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
import SchoolLogin from "$lib/components/SchoolLogin.svelte";
</script>

<SchoolLogin/>
5 changes: 5 additions & 0 deletions src/routes/school/register/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
import SchoolRegister from "$lib/components/SchoolRegister.svelte";
</script>

<SchoolRegister/>
File renamed without changes.
5 changes: 5 additions & 0 deletions src/routes/sobre/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
import Sobre from "$lib/components/Sobre.svelte";
</script>

<Sobre/>

0 comments on commit baabb0c

Please sign in to comment.