Skip to content
Merged

Dev #180

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
4 changes: 2 additions & 2 deletions app/components/sections/organizers/organizers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
OurTeamCard,
type OurTeamCardProps,
} from "~/components/shared/card/our-team";
import { cn, parseOrganizerImage } from "~/lib/utils";
import { cn, parseOrganizerImage, parseVolunteerImage } from "~/lib/utils";

interface OrganizersSectionProps {
organizers: OrganizerPublicType[];
Expand Down Expand Up @@ -86,7 +86,7 @@ export const OrganizersSection = ({
id: volunteerItem.id,
name: getFullName(volunteerItem),
email: volunteerItem?.user?.email || undefined,
profile_picture: parseOrganizerImage({ id: volunteerItem.id }),
profile_picture: parseVolunteerImage({ id: volunteerItem.id }),
twitter_username:
(volunteerItem?.user?.twitter_username &&
`https://twitter.com/${volunteerItem?.user?.twitter_username}`) ||
Expand Down
6 changes: 4 additions & 2 deletions app/components/sections/schedules/schedules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ export const SchedulesSection = ({
).sort((a, b) => new Date(a).getTime() - new Date(b).getTime());

const [open, setOpen] = useState(false);
const [selectedDate, setSelectedDate] = useState(sortedDates[0]);
const [selectedDate, setSelectedDate] = useState(
sortedDates[sortedDates.length - 1],
);
const [openDropdown, setOpenDropdown] = useState(false);
const [selectedScheduleId, setSelectedScheduleId] = useState<
ScheduleItemType["id"] | null
Expand All @@ -76,7 +78,7 @@ export const SchedulesSection = ({

useEffect(() => {
if (sortedDates.length > 0 && !selectedDate) {
setSelectedDate(sortedDates[0]);
setSelectedDate(sortedDates[sortedDates.length - 1]);
}
}, [sortedDates, selectedDate]);

Expand Down
6 changes: 6 additions & 0 deletions app/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export const parseOrganizerImage = ({ id }: { id: string }) => {
return `${url}/organizer/${id}/profile-picture`;
};

export const parseVolunteerImage = ({ id }: { id: string }) => {
if (!id) return "";
const url = import.meta.env.VITE_BASE_API;
return `${url}/volunteer/${id}/profile-picture/`;
};

export const onAvatarError = (
evt: React.SyntheticEvent<HTMLImageElement, Event>,
) => {
Expand Down