Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ✨ create group page #30

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/lib/components/SideBar/SideBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

<div
id="sidebar"
class="flex flex-col w-full h-full rounded-r-none rounded-left-lg md:rounded-r-lg md:rounded-l-none bg-secondary-400 outline-secondary-800 card outline-5"
class="rounded-left-lg outline-5 card flex h-full w-full flex-col rounded-r-none bg-secondary-400 outline-secondary-800 md:rounded-l-none md:rounded-r-lg"
>
<div id="sidebar-links" class="flex flex-col">
{#if displayCloseButton}
<div class="w-full flex flex-row justify-end">
<button class="p-2 ml-auto" on:click={closeDrawer}>
<div class="flex w-full flex-row justify-end">
<button class="ml-auto p-2" on:click={closeDrawer}>
<CloseIcon class="h-12 w-12" />
</button>
</div>
Expand All @@ -31,7 +31,7 @@
<SideBarLink Icon={SettingsIcon} label="Settings" href="/settings" />
</div>

<div id="sidebar-footer-container" class="mt-auto m-2">
<div id="sidebar-footer-container" class="m-2 mt-auto">
<SideBarFooter />
</div>
</div>
24 changes: 24 additions & 0 deletions src/lib/components/groups/MembersCarousel.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<script lang="ts">
import { members } from "$lib/stores/groupStores";
</script>

<div class="flex snap-x snap-mandatory gap-2 overflow-x-auto scroll-smooth md:gap-4">
{#each $members as member (member.id)}
<a
class="grid align-middle"
href={member.profile_page}
target="_blank"
referrerpolicy="no-referrer"
>
<div
class="card flex h-24 w-24 snap-start rounded-lg bg-cover bg-center px-2 md:h-40 md:w-40"
style="background-image:url({member.profile_picture})"
></div>
<p
class=" mt-auto line-clamp-2 max-h-12 text-left text-lg font-bold text-black hover:text-blue-500 md:text-xl"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class=" mt-auto line-clamp-2 max-h-12 text-left text-lg font-bold text-black hover:text-blue-500 md:text-xl"
class="mt-auto line-clamp-2 max-h-12 text-left text-lg font-bold text-black hover:text-blue-500 md:text-xl"

>
@{member.username}
</p>
</a>
{/each}
</div>
2 changes: 1 addition & 1 deletion src/lib/components/summary/GroupsCarousel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<div class="flex snap-x snap-mandatory gap-2 overflow-x-auto scroll-smooth md:gap-4">
{#each $groups as group (group.id)}
<a href={group.link} target="_blank" referrerpolicy="no-referrer">
<a href="groups/{group.id}" target="_blank" referrerpolicy="no-referrer">
<div
class="card flex h-24 w-36 snap-start rounded-lg bg-cover bg-center p-3 md:h-36 md:w-64"
style="background-image:url({group.img})"
Expand Down
23 changes: 20 additions & 3 deletions src/lib/components/summary/ScheduledMeetingsList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,32 @@
import { RadioGroup, RadioItem } from "@skeletonlabs/skeleton";

import { scheduledMeetings } from "$lib/stores/summaryStores";
import type { ScheduledMeeting } from "$lib/types/meetings";
import {
convertIsoToWeekdayDate,
convertTo12HourFormat,
filterMeetingsByGroupID,
groupAndSortScheduledMeetings,
} from "$lib/utils/summary-helpers";
import LocationIcon from "~icons/material-symbols/location-on";
import ClockIcon from "~icons/material-symbols/nest-clock-farsight-analog-outline";

const sortedMeetings = groupAndSortScheduledMeetings($scheduledMeetings);
export let groupID: number | undefined;
// const modalStore = getModalStore();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the commented-out code? You can always go back to this PR and check the history if you want to refer to it in the future.


const filtered = groupID
? filterMeetingsByGroupID($scheduledMeetings, groupID)
: $scheduledMeetings;
const sortedMeetings = groupAndSortScheduledMeetings(filtered as ScheduledMeeting[]);

// function modalComponentList(): void {
// const modal: ModalSettings = {
// type: "component",
// component: "meetingUsers",
// title: "Users Attending Meeting",
// };
// modalStore.trigger(modal);
// }
</script>

{#each Object.keys(sortedMeetings) as date}
Expand Down Expand Up @@ -45,7 +62,7 @@
</div>
</div>

<div class="flex w-full justify-center md:w-fit">
<div class="flex w-full justify-center md:w-fit" role="radiogroup" tabindex="0">
<RadioGroup
class="flex h-fit w-fit items-center"
active="variant-filled-primary"
Expand All @@ -54,7 +71,7 @@
<RadioItem bind:group={meeting.attending} name="justify" value={"Yes"} required
>Yes</RadioItem
>
<RadioItem bind:group={meeting.attending} name="justify" value={"No"} required
<RadioItem bind:group={meeting.attending} name="justify" value={"No"} required }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<RadioItem bind:group={meeting.attending} name="justify" value={"No"} required }
<RadioItem bind:group={meeting.attending} name="justify" value={"No"} required

>No</RadioItem
>
<RadioItem bind:group={meeting.attending} name="justify" value={"Maybe"} required
Expand Down
8 changes: 7 additions & 1 deletion src/lib/components/summary/UnscheduledMeetingsList.svelte
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
<script lang="ts">
import { unscheduledMeetings } from "$lib/stores/summaryStores";
import type { UnscheduledMeeting } from "$lib/types/meetings";
import {
convertIsoToDate,
convertTo12HourFormat,
filterMeetingsByGroupID,
sortUnscheduledMeetingsByDateAndTime,
} from "$lib/utils/summary-helpers";
import CalendarIcon from "~icons/material-symbols/calendar-month";
import LocationIcon from "~icons/material-symbols/location-on";
import ClockIcon from "~icons/material-symbols/nest-clock-farsight-analog-outline";

const sortedMeetings = sortUnscheduledMeetingsByDateAndTime($unscheduledMeetings);
export let groupID: number | undefined;
const filtered = groupID
? filterMeetingsByGroupID($unscheduledMeetings, groupID)
: $unscheduledMeetings;
const sortedMeetings = sortUnscheduledMeetingsByDateAndTime(filtered as UnscheduledMeeting[]);
</script>

<div class="flex flex-col gap-2">
Expand Down
63 changes: 63 additions & 0 deletions src/lib/stores/groupStores.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { writable } from "svelte/store";

import type { Member } from "$lib/types/members";

const exampleMembers: Member[] = [
{
id: "1",
username: "georgeconstanza",
email: "[email protected]",
profile_picture:
"https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?q=80&w=1287&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
profile_page: `/users/whodunit`,
created_at: new Date(),
},
{
id: "2",
username: "randyalphari",
email: "[email protected]",
profile_picture:
"https://images.unsplash.com/photo-1500648767791-00dcc994a43e?q=80&w=1287&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
profile_page: `/users/youserone`,
created_at: new Date(),
},
{
id: "3",
username: "jamescohen",
email: "[email protected]",
profile_picture:
"https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
profile_page: `/users/salaman`,
created_at: new Date(),
},
{
id: "4",
username: "adamyoung",
email: "[email protected]",
profile_picture:
"https://images.unsplash.com/photo-1633332755192-727a05c4013d?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
profile_page: `/users/george42`,
created_at: new Date(),
},
{
id: "5",
username: "davidli",
email: "[email protected]",
profile_picture:
"https://images.unsplash.com/photo-1544168190-79c17527004f?q=80&w=1288&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
profile_page: `/users/ren2`,
created_at: new Date(),
},
{
id: "6",
username: "christinej",
email: "[email protected]",
profile_picture:
"https://images.unsplash.com/photo-1619895862022-09114b41f16f?q=80&w=1170&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
profile_page: `/users/chlo1`,
created_at: new Date(),
},
];

export const members = writable<Member[]>(exampleMembers);
export const attendees = writable<Member[]>(exampleMembers);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unused and should be deleted.

8 changes: 8 additions & 0 deletions src/lib/stores/summaryStores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const dummyScheduledMeetings: ScheduledMeeting[] = [
endTime: "13:30",
attending: "Yes",
location: "CSL 8",
groupID: 1,
},
{
name: "Meeting Two",
Expand All @@ -61,6 +62,7 @@ const dummyScheduledMeetings: ScheduledMeeting[] = [
endTime: "15:00",
attending: "No",
location: "CSL 8",
groupID: 2,
},
{
name: "Meeting Three",
Expand All @@ -71,6 +73,7 @@ const dummyScheduledMeetings: ScheduledMeeting[] = [
endTime: "15:00",
attending: "Yes",
location: "CSL 8",
groupID: 3,
},
{
name: "Meeting Four",
Expand All @@ -81,6 +84,7 @@ const dummyScheduledMeetings: ScheduledMeeting[] = [
endTime: "15:00",
attending: "Maybe",
location: "CSL 8",
groupID: 4,
},
];

Expand All @@ -94,6 +98,7 @@ const dummyUnscheduledMeetings: UnscheduledMeeting[] = [
startTime: "11:00",
endTime: "13:30",
location: "CSL 8",
groupID: 2,
},
{
name: "Meeting Dos",
Expand All @@ -104,6 +109,7 @@ const dummyUnscheduledMeetings: UnscheduledMeeting[] = [
startTime: "8:00",
endTime: "15:00",
location: "CSL 8",
groupID: 1,
},
{
name: "Meeting Tres",
Expand All @@ -114,6 +120,7 @@ const dummyUnscheduledMeetings: UnscheduledMeeting[] = [
startTime: "8:00",
endTime: "15:00",
location: "CSL 8",
groupID: 4,
},
{
name: "Meeting Quatro",
Expand All @@ -124,6 +131,7 @@ const dummyUnscheduledMeetings: UnscheduledMeeting[] = [
startTime: "8:00",
endTime: "15:00",
location: "CSL 8",
groupID: 3,
},
];

Expand Down
2 changes: 2 additions & 0 deletions src/lib/types/meetings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type ScheduledMeeting = {
endTime: string;
attending: string;
location: string;
groupID?: number;
};

export type UnscheduledMeeting = {
Expand All @@ -22,4 +23,5 @@ export type UnscheduledMeeting = {
startTime: string;
endTime: string;
location: string;
groupID?: number;
};
8 changes: 8 additions & 0 deletions src/lib/types/members.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type Member = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be called GroupMember just to make it clearer.

id: string;
username: string;
email: string;
profile_picture: string;
profile_page: string;
created_at: Date;
};
6 changes: 6 additions & 0 deletions src/lib/utils/summary-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ export function groupAndSortScheduledMeetings(scheduledMeetings: ScheduledMeetin
return groupedMeetings;
}

export function filterMeetingsByGroupID(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this (and other relevant function(s)) to the component in which it's used, if it's only used in one.

meetings: UnscheduledMeeting[] | ScheduledMeeting[],
groupID: number,
) {
return meetings.filter((s) => s.groupID == groupID);
}
export function sortScheduledMeetingsByDateAndTime(scheduledMeetings: ScheduledMeeting[]) {
return scheduledMeetings.sort((a, b) => {
const dateComparison = a.date.localeCompare(b.date);
Expand Down
5 changes: 5 additions & 0 deletions src/routes/groups/[groupID]/+page.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export function load({ params }) {
const groupID = Number(params.groupID);

return { groupID };
}
58 changes: 58 additions & 0 deletions src/routes/groups/[groupID]/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<script lang="ts">
import { TabGroup, Tab } from "@skeletonlabs/skeleton";

import MembersList from "$lib/components/groups/MembersCarousel.svelte";
import ScheduledMeetingsList from "$lib/components/summary/ScheduledMeetingsList.svelte";
import UnscheduledMeetingsList from "$lib/components/summary/UnscheduledMeetingsList.svelte";
import { groups } from "$lib/stores/summaryStores";

export let data;
const groupID = data.groupID;
const group = $groups.find((g) => g.id === groupID)!;

let tabSet: number = 0;
</script>

<div class="flex flex-col gap-8 px-4 pb-2 pt-6 md:px-32">
<div
class="grid-rows-[100px_minmax(0, 1fr)] grid grid-cols-[120px_minmax(0,1fr)] content-start md:grid-cols-2 md:gap-4"
>
<img
src={group.img}
alt="A cute dog"
class="row-start-1 row-end-2 h-24 w-24 object-cover object-center md:row-start-2 md:row-end-3 md:h-40 md:w-40 lg:h-64 lg:w-64"
/>
<h1
class="self-center overflow-visible text-3xl font-bold sm:col-start-2 sm:col-end-3 md:col-span-2 md:text-5xl lg:text-6xl"
>
{group.name}
</h1>
</div>

<div class="flex flex-col gap-4">
<h1 class="border-surface-400-500-token border-b text-4xl font-bold">Members</h1>
<MembersList />
</div>

<div class="flex flex-col gap-4">
<TabGroup>
<div class="flex w-full flex-col gap-x-10 gap-y-2">
<h1 class="text-4xl font-bold">Meetings</h1>
<div class="flex justify-center gap-5">
<Tab bind:group={tabSet} name="scheduledTab" value={0}>Scheduled</Tab>
<Tab bind:group={tabSet} name="unscheduledTab" value={1}>Unscheduled</Tab>
</div>
</div>

<svelte:fragment slot="panel">
{#if tabSet === 0}
<div class="flex flex-col gap-4"><ScheduledMeetingsList {groupID} /></div>
{:else if tabSet === 1}
<div class="flex flex-col gap-2">
<UnscheduledMeetingsList {groupID} />
</div>
{/if}
</svelte:fragment>
</TabGroup>
</div>
</div>
Loading