Skip to content

Commit

Permalink
Refactor styling and wording, fix email sending, and disable animation (
Browse files Browse the repository at this point in the history
#153)

This pull request includes several commits that refactor the styling and wording of the max amount of auctions feature, fix an issue with extra space, fix a bug where emails were not being sent after the first successful email, wrap promises in a promise all, set the emailed value on the correct user, and disable an animation temporarily. These changes improve the user experience and fix bugs in the code.
  • Loading branch information
DarthGigi committed Sep 11, 2024
2 parents 725e0ad + 48f830a commit 647c6da
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 38 deletions.
6 changes: 1 addition & 5 deletions src/routes/(main)/(protected)/profile/(profile)/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,7 @@
</Card.Root>
</form>
{:else}
<div class="space-y-8 divide-y divide-secondary rounded-lg bg-background px-6 py-8 text-primary">
<div class="space-y-8 divide-y divide-secondary">
<div>You can't have more than 9 minions on the AH. Delete a few in order to make a new one</div>
</div>
</div>
<div class="rounded-lg border border-border bg-popover p-6 text-primary">You can't have more than 18 active auctions. Delete a few in order to make a new one</div>
{/if}
{/await}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@

<div class="py-8 max-md:pb-20">
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
<div role="list" class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
{#await data.streamed.chats then chats}
{#await data.streamed.chats then chats}
<div role="list" class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
{#each chats as chat}
{@const chatUser = chat.user1_id === data.user?.id ? chat.user2 : chat.user1}
{@const read = checkReadStatus(chat, data.user?.id)}
Expand Down Expand Up @@ -116,11 +116,11 @@
</div>
</div>
{/each}
{#if chats.length === 0}
<p class="text-muted-foreground">You have no chats yet.</p>
{/if}
{/await}
</div>
</div>
{#if chats.length === 0}
<p class="w-full text-center text-muted-foreground">You have no chats yet.</p>
{/if}
{/await}
</div>
</div>

Expand Down
7 changes: 5 additions & 2 deletions src/routes/(main)/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import TierListbox from "$lib/components/TierListbox.svelte";
import UsersListBox from "$lib/components/UsersListBox.svelte";
import { MinionCard } from "$lib/components/card";
import { GradualSpacing } from "$lib/components/magicui";
import AnimatedShinyText from "$lib/components/magicui/animated-shiny-text.svelte";
import NumberTicker from "$lib/components/magicui/number-ticker.svelte";
import { Button } from "$lib/components/ui/button";
Expand Down Expand Up @@ -248,8 +247,12 @@
<h2 class="sr-only">MinionAH - The Auction House for SkyBlock Minions</h2>

<div class="mt-8 h-10 md:mt-20 md:h-20">
<GradualSpacing class="text-center text-4xl font-bold tracking-[-0.1em] text-white md:text-7xl md:leading-[5rem]" text="MinionAH" />
<!-- <GradualSpacing class="text-center text-4xl font-bold tracking-[-0.1em] text-white md:text-7xl md:leading-[5rem]" text="MinionAH" /> -->
<div class="flex justify-center space-x-1">
<span class="text-center text-4xl font-bold tracking-[-0.045em] text-white md:text-7xl md:leading-[5rem]">MinionAH</span>
</div>
</div>

<Button href="/pricecheck" class="group z-10 mx-auto mt-2 flex w-fit items-center justify-center rounded-full border border-white/5 bg-neutral-900 text-base text-white transition-all ease-in hover:cursor-pointer hover:bg-neutral-800" variant="ghost">
<AnimatedShinyText class="inline-flex items-center justify-center px-4 py-1 transition ease-out hover:text-neutral-400 hover:duration-300">
<span>💰 <span class="max-sm:hidden">Introducing </span>Price Checker</span>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/(main)/signup/(protected)/password/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
timeout.subscribe((value) => {
if (value) {
toast.loading("It's taking longer than expected to create your account...", {
toast.loading("It's taking longer than expected to create your account...", {
id: $toastLoading
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,24 +261,25 @@ export const actions = {
})
.then(async (res) => {
if (res.status === 200) {
await prisma.message.create({
data: {
chat_id: chat!.id,
content: messageJSON.content,
user_id: user.id,
type: messageType
}
});

await prisma.chat.update({
where: {
id: chat!.id
},
data: {
user1Read: user.id === chat!.user1_id ? chat!.user1Read : false,
user2Read: user.id === chat!.user2_id ? chat!.user2Read : false
}
});
await Promise.all([
prisma.message.create({
data: {
chat_id: chat!.id,
content: messageJSON.content,
user_id: user.id,
type: messageType
}
}),
prisma.chat.update({
where: {
id: chat!.id
},
data: {
user1Read: user.id === chat!.user1_id ? chat!.user1Read : false,
user2Read: user.id === chat!.user2_id ? chat!.user2Read : false
}
})
]);
}
})
.catch((err) => {
Expand Down Expand Up @@ -397,7 +398,7 @@ export const actions = {
}
});

const alreadySentEmail = user.id === chat.user1_id ? chat.user1Emailed : chat.user2Emailed;
const alreadySentEmail = user.id === chat.user1_id ? chat.user2Emailed : chat.user1Emailed;

if (profileSettings && !alreadySentEmail) {
if (notificationSettings?.notificationType === "ALL" || notificationSettings?.notificationType === "EMAIL") {
Expand All @@ -422,8 +423,8 @@ export const actions = {
id: chat.id
},
data: {
user1Emailed: user.id === chat.user1_id ? true : chat.user1Emailed,
user2Emailed: user.id === chat.user2_id ? true : chat.user2Emailed
user1Emailed: user2?.id === chat.user1_id ? true : chat.user1Emailed,
user2Emailed: user2?.id === chat.user2_id ? true : chat.user2Emailed
}
});
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ export const PUT: RequestHandler = async ({ locals, params }) => {
}

let unreadChats: number = 0;
if ((user.id === chat.user1_id && !chat.user1Read) || (user.id === chat.user2_id && !chat.user2Read)) {
if ((user.id === chat.user1_id && !chat.user1Read) || (user.id === chat.user2_id && !chat.user2Read) || (user.id === chat.user1_id && chat.user1Emailed) || (user.id === chat.user2_id && chat.user2Emailed)) {
const updatedChat = await prisma.chat.update({
where: {
id: chat.id
},
data: {
user1Read: user.id === chat.user1_id ? true : chat.user1Read,
user2Read: user.id === chat.user2_id ? true : chat.user2Read
user2Read: user.id === chat.user2_id ? true : chat.user2Read,
user1Emailed: user.id === chat.user1_id ? false : chat.user1Emailed,
user2Emailed: user.id === chat.user2_id ? false : chat.user2Emailed
}
});

Expand Down

0 comments on commit 647c6da

Please sign in to comment.