Skip to content

Commit

Permalink
Merge pull request #924 from appwrite/fix-event-card-button
Browse files Browse the repository at this point in the history
Disable view event button for past events
  • Loading branch information
TorstenDittmann authored Jun 5, 2024
2 parents 84433f2 + 1d5e708 commit e05daed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/routes/community/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
src: '/images/community/events/28march-office-hours.png',
alt: ''
},
date: 'March 28th, 2024',
date: '2024-03-28',
location: 'Discord',
title: 'Office Hours: Ask me anything!',
description:
Expand All @@ -19,7 +19,7 @@
src: '/images/community/events/4april-office-hours.png',
alt: ''
},
date: 'April 4th, 2024',
date: '2024-04-04',
location: 'Discord',
title: 'Office Hours: Ask me anything!',
description:
Expand All @@ -32,7 +32,7 @@
src: '/images/community/events/11april-office-hours.png',
alt: ''
},
date: 'April 11th, 2024',
date: '2024-04-11',
location: 'Discord',
title: 'Office Hours: Ask me anything!',
description:
Expand Down
13 changes: 8 additions & 5 deletions src/routes/community/EventCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
export let description: $$Props['description'];
export let buttonText: $$Props['buttonText'];
export let headingLevel: $$Props['headingLevel'] = 5;
const hasPast: boolean = (new Date()) > (new Date(date));
const dateString: string = new Date(date).toLocaleDateString('en-US', {
month: 'long',
day: 'numeric',
year: 'numeric',
});
$: headingTag = `h${headingLevel}`;
</script>

Expand All @@ -36,7 +42,7 @@
<ul class="u-flex u-flex-wrap web-u-list-inline-dot-sep">
<li class="u-flex u-cross-baseline u-gap-4">
<span class="web-icon-calendar web-u-color-text-tertiary" aria-hidden="true" />
<time class="">{date}</time>
<time class="">{dateString}</time>
</li>
<li class="u-flex u-cross-baseline u-gap-4">
<span class="web-icon-location web-u-color-text-tertiary" aria-hidden="true" />
Expand All @@ -53,12 +59,9 @@
{description}
</p>
<div class="u-flex u-flex-wrap u-gap-8 u-padding-block-start-16 mbs-auto">
<button class="web-button is-secondary">
<button class="web-button is-secondary" disabled={hasPast}>
<span>{buttonText}</span>
</button>
<!-- <button class="web-button is-text">
<span>Add to calendar</span>
</button> -->
</div>
</div>
</a>
Expand Down

0 comments on commit e05daed

Please sign in to comment.