Skip to content

Commit

Permalink
fix: minor general fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
domysh committed Sep 18, 2024
1 parent 37e8bdc commit 36c3fbe
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 33 deletions.
2 changes: 1 addition & 1 deletion public/assets/vectors/pin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions public/assets/vectors/time.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions src/components/Schedule/Pages/ScheduleList.astro
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
---
import ScheduleCard from "../ScheduleCard.astro";
import { getLangFromUrl, useTranslations } from "../../../i18n/utils";
import { getSchedule } from "../../../data/api/sessionize_api";
import ScheduleTab from "./ScheduleTab.astro";
/*
- 51235:"Frontend"
- 51236:"Mobile"
Expand All @@ -17,8 +15,6 @@ import ScheduleTab from "./ScheduleTab.astro";
- 53350:"WS III"
*/
const schedule = await getSchedule()
const lang = getLangFromUrl(Astro.url);
const t = useTranslations(lang);
Expand Down
12 changes: 8 additions & 4 deletions src/components/Schedule/Pages/ScheduleTab.astro
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
---
import type { ScheduleDay } from "../../../data/types/sessionize";
import { getLangFromUrl } from "../../../i18n/utils";
import ScheduleCard from "../ScheduleCard.astro";
import { capitalizeFirstLetter } from "../../../react/utils";
interface Props {
schedule: any;
rooms?: any;
schedule: ScheduleDay[];
rooms?: number[];
}
const lang = getLangFromUrl(Astro.url);
const { schedule, rooms } = Astro.props;
const calcSlotsTaken = (s, tsr, ts_idx) => {
Expand Down Expand Up @@ -55,11 +59,11 @@ const calcSlotsTaken = (s, tsr, ts_idx) => {
return <>
<div class="mb-5">
<p class="text-3xl font-bold mb-5">
{new Date(s.date).toLocaleDateString("en-US", {
{capitalizeFirstLetter(new Date(s.date).toLocaleDateString(lang, {
day: "numeric",
month: "long",
weekday: "long",
})}
}))}
</p>
{/* Some classes are created manually due to tilewind issues */}
<div class={`grid grid-flow-row grid-cols-layout-${totalScheduleCols} grid-rows-layout-${totalScheduleRows} grid-cols-1 gap-4`} >
Expand Down
23 changes: 6 additions & 17 deletions src/components/Sessions/Pages/SessionDetail.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { getLangFromUrl, useTranslatedPath, useTranslations } from '../../../i18
import AddToCalendar from '../../Common/AddToCalendar.astro';
import BaseLayout from '../../Common/BaseLayout.astro';
import SessionTopic from '../SessionTopic.astro';
import { capitalizeFirstLetter } from "../../../react/utils";
interface Props {
entry: SessionInfo;
Expand All @@ -30,33 +31,21 @@ const dateEnd = new Date(entry.endsAt);
const isScheduled = dateStart.getTime() != 0;
var date = dateStart.toLocaleDateString("en-US", {
var date = capitalizeFirstLetter(dateStart.toLocaleDateString(lang, {
day: "numeric",
month: "short",
});
}));
const start = dateStart.toLocaleTimeString("en-US", {
const start = dateStart.toLocaleTimeString(lang, {
hour: "numeric",
minute: "numeric",
});
const end = dateEnd.toLocaleTimeString("en-US", {
const end = dateEnd.toLocaleTimeString(lang, {
hour: "numeric",
minute: "numeric",
});
function formatDate(date: Date) {
const year = date.getUTCFullYear();
const month = date.getUTCMonth() + 1;
const day = date.getUTCDate();
const hours = date.getUTCHours();
const minutes = date.getUTCMinutes();
return `${year}${month}${day > 9 ? day : "0" + day}T${
hours > 9 ? hours : "0" + hours
}${minutes > 9 ? minutes : "0" + minutes}00Z`;
}
const pageTitle = entry.title;
const pageDesc = entry.description;
---
Expand Down Expand Up @@ -92,7 +81,7 @@ const pageDesc = entry.description;
{entry.topics.map((t) => <SessionTopic brightness="dark" topic={t} />)}
</div>
<div class="mb-6">
<p class="text-lg">{entry.room}</p>
<p class="text-lg">{t("session.room")}: {entry.room}</p>
{
isScheduled && (
<p class="text-lg">
Expand Down
2 changes: 1 addition & 1 deletion src/components/Sessions/SessionCard.astro
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const t = useTranslations(lang);
---
<a
href={getPath(`/sessions/${session.slug}`)}
class="p-3 card bg-white text-base-content md:hover:scale-110 rounded-lg animated flex flex-col h-80"
class="p-3 card bg-white text-base-content md:hover:scale-110 rounded-lg animated flex flex-col h-[22rem]"
>
<div class="flex justify-between gap-4">
<p class="text-xl font-medium mb-3">{session.title}</p>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Speakers/Pages/SpeakerDetail.astro
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const pageTitle = `${speaker.fullName} @ ${WebsiteConfig.DEVFEST_NAME}`;
const dateStart = new Date(session.startsAt);
const dateEnd = new Date(session.endsAt);

const date = dateStart.toLocaleDateString("en-US", {
const date = dateStart.toLocaleDateString(lang, {
month: "long",
day: "numeric",
});
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const ui = {
'speakers.detailTitle': 'Speaker details',
'speakers.sessionList': 'Sessions',
'scheduling.noschedule': 'Schedule not available',
'session.room': 'Room',
},
it: {
'nav.home': 'Home',
Expand Down Expand Up @@ -74,5 +75,6 @@ export const ui = {
'speakers.detailTitle': 'Dettagli speaker',
'speakers.sessionList': 'Sessioni',
'scheduling.noschedule': 'Schedule non disponibile',
'session.room': 'Aula',
},
} as const;
6 changes: 3 additions & 3 deletions src/react/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const isEmailValid = (email: string) => {
return emailRegex.test(email)
}




export function capitalizeFirstLetter(string:string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}

0 comments on commit 36c3fbe

Please sign in to comment.