Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Dorschner authored and Guillaume Dorschner committed Nov 10, 2023
2 parents a645baf + 5d84372 commit 01f9e5a
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 45 deletions.
92 changes: 47 additions & 45 deletions client/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
import { onMount } from "svelte";
onMount(() => {
const card = document.querySelector('.card');
const container = document.querySelector('.card-container');
container.addEventListener('mousemove', (e) => {
let xAxis = -(window.innerWidth / 2 - e.pageX) / 140;
let yAxis = (window.innerHeight / 2 - e.pageY) / 140;
card.style.transform = `rotateY(${xAxis}deg) rotateX(${yAxis}deg)`;
});
container.addEventListener('mouseenter', (e) => {
card.style.transition = "none";
});
container.addEventListener('mouseleave', (e) => {
card.style.transition = "transform 0.2s";
card.style.transform = `rotateY(0deg) rotateX(0deg)`;
});
const card = document.querySelector(".card");
const container = document.querySelector(".card-container");
container.addEventListener("mousemove", (e) => {
let xAxis = -(window.innerWidth / 2 - e.pageX) / 140;
let yAxis = (window.innerHeight / 2 - e.pageY) / 140;
card.style.transform = `rotateY(${xAxis}deg) rotateX(${yAxis}deg)`;
});
container.addEventListener("mouseenter", (e) => {
card.style.transition = "none";
});
container.addEventListener("mouseleave", (e) => {
card.style.transition = "transform 0.2s";
card.style.transform = `rotateY(0deg) rotateX(0deg)`;
});
});
</script>

Expand Down Expand Up @@ -48,38 +48,41 @@
</div>
</header>

<div class="">
<section class="min-h-96 relative flex flex-1 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-gray-100 py-16 shadow-lg md:py-20 xl:py-48">
<!-- <div class="card-container">
<section class="card shadow-xl shadow-primary min-h-96 relative flex flex-1 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-gray-100 py-16 shadow-lg md:py-20 xl:py-48"> -->
<!-- <div class="">
<section
class="min-h-96 relative flex flex-1 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-gray-100 py-16 shadow-lg md:py-20 xl:py-48"
> -->
<div class="card-container">
<section class="card shadow-xl min-h-96 relative flex flex-1 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-gray-100 py-16 shadow-lg md:py-20 xl:py-48">

<img
src="https://plus.unsplash.com/premium_photo-1670884128248-858c56bdb838?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1740&q=80"
loading="lazy"
alt="girls"
class="absolute inset-0 h-full w-full object-cover object-center"
/>
<img
src="https://plus.unsplash.com/premium_photo-1670884128248-858c56bdb838?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1740&q=80"
loading="lazy"
alt="girls"
class="absolute inset-0 h-full w-full object-cover object-center"
/>

<div class="absolute inset-0 bg-secondary mix-blend-multiply" />
<div class="absolute inset-0 bg-secondary mix-blend-multiply" />

<div class="relative flex flex-col items-center p-4 sm:max-w-xl">
<h1
class="mb-8 text-center text-4xl font-bold text-white sm:text-5xl md:mb-12 md:text-6xl"
>
Easy, simple like the good old days
</h1>

<div class="flex w-full flex-col gap-2.5 sm:flex-row sm:justify-center">
<a
href="/signup"
class="inline-block rounded-lg bg-primary px-8 py-3 text-center text-sm font-semibold text-white outline-none ring-tone transition duration-100 hover:bg-secondary focus-visible:ring active:bg-secondary md:text-base"
>Start now</a
<div class="relative flex flex-col items-center p-4 sm:max-w-xl">
<h1
class="mb-8 text-center text-4xl font-bold text-white sm:text-5xl md:mb-12 md:text-6xl"
>
</div>
</div>
Easy, simple like the good old days
</h1>

</section>
</div>
<div
class="flex w-full flex-col gap-2.5 sm:flex-row sm:justify-center"
>
<a
href="/signup"
class="inline-block rounded-lg bg-primary px-8 py-3 text-center text-sm font-semibold text-white outline-none ring-tone transition duration-100 hover:bg-secondary focus-visible:ring active:bg-secondary md:text-base"
>Start now</a
>
</div>
</div>
</section>
</div>
</div>
</div>

Expand Down Expand Up @@ -893,7 +896,6 @@
</div>
</footer>


<style>
.card-container {
perspective: 1000px;
Expand Down
38 changes: 38 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,44 @@ app.post("/likePost", async (req, res) => {
}
});

app.delete("/deleteUser", async (req, res) => {
try {
const userCookie = req.cookies.user;

if (userCookie) {
const user = JSON.parse(userCookie);
const user_id = user.user_id;

if (!user_id) {
res.status(400).json({ message: "Invalid Request" });
return;
}

const database = await connectDatabase();

const query = `
DELETE FROM users WHERE user_id = ${user_id} RETURNING *;
`;

const result = await database.query(query);

if (result.rows.length > 0) {
res.clearCookie("user");
res.status(200).json({
message: "Account deleted successfully",
});
} else {
res.status(500).json({ message: "Error deleting account" });
}
} else {
res.status(401).json({ message: "Unauthorized" });
}
} catch (error) {
console.error(error);
res.status(500).json({ message: "Internal Server Error" });
}
});

app.use("/api/v1", api);
app.use(notFound);
app.use(errorHandler);
Expand Down

0 comments on commit 01f9e5a

Please sign in to comment.