diff --git a/.env.dev b/.env.dev index 64f6b8d..c225f43 100644 --- a/.env.dev +++ b/.env.dev @@ -6,4 +6,5 @@ API_PATH=/CSLD_war/CSLD/graphql USER_ICON_PATH=/CSLD_war/CSLD/user-icon GAME_IMAGE_PATH=/CSLD_war/CSLD/game-image ICAL_PATH=/CSLD_war/CSLD/ical +CAL_SYNC_PATH=/cal-sync NEXT_PUBLIC_GA_TRACKING_ID=UA-37900730-1 diff --git a/.env.dev.prod b/.env.dev.prod index 0f79505..8ddcbf6 100644 --- a/.env.dev.prod +++ b/.env.dev.prod @@ -6,4 +6,5 @@ API_PATH=/graphql USER_ICON_PATH=/user-icon GAME_IMAGE_PATH=/game-image ICAL_PATH=/ical +CAL_SYNC_PATH=/cal-sync NEXT_PUBLIC_GA_TRACKING_ID=UA-37900730-1 diff --git a/.env.dev.staging b/.env.dev.staging index d56ea80..a1f8f0c 100644 --- a/.env.dev.staging +++ b/.env.dev.staging @@ -6,4 +6,5 @@ API_PATH=/graphql USER_ICON_PATH=/user-icon GAME_IMAGE_PATH=/game-image ICAL_PATH=/ical +CAL_SYNC_PATH=/cal-sync NEXT_PUBLIC_GA_TRACKING_ID=UA-37900730-1 diff --git a/.env.prod b/.env.prod index ac02042..1a6e5e4 100644 --- a/.env.prod +++ b/.env.prod @@ -6,4 +6,5 @@ API_PATH=/graphql USER_ICON_PATH=/user-icon GAME_IMAGE_PATH=/game-image ICAL_PATH=/ical +CAL_SYNC_PATH=/cal-sync NEXT_PUBLIC_GA_TRACKING_ID=UA-37900730-1 diff --git a/public/static/images/lk-logo.png b/public/static/images/lk-logo.png new file mode 100644 index 0000000..0118bfd Binary files /dev/null and b/public/static/images/lk-logo.png differ diff --git a/public/static/locales/cs/common.json b/public/static/locales/cs/common.json index aa18af9..0fc295b 100644 --- a/public/static/locales/cs/common.json +++ b/public/static/locales/cs/common.json @@ -371,6 +371,8 @@ "optional": "Volitelné" }, "EventCalendar": { + "pageTitle": "Larpový kalendář", + "pageDescription": "Všechny larpy v jednom kalendáři", "events": "Události", "link": "Web akce", "eventFrom": "Od", diff --git a/server/proxy.ts b/server/proxy.ts index ddb3b28..50c0a5b 100644 --- a/server/proxy.ts +++ b/server/proxy.ts @@ -51,6 +51,7 @@ const proxy = ({ USER_ICON_PATH, GAME_IMAGE_PATH, ICAL_PATH, + CAL_SYNC_PATH, }: { [key: string]: string | undefined }): { [key: string]: {} } => ({ @@ -75,6 +76,11 @@ const proxy = ({ pathRewrite: { '^/ical': ICAL_PATH }, changeOrigin: true, }, + '/cal-sync': { + target: API_URL, + pathRewrite: { '^/cal-sync': CAL_SYNC_PATH }, + changeOrigin: true, + }, }) export default proxy diff --git a/src/components/EventCalendar/EventCalendarListPanel.tsx b/src/components/EventCalendar/EventCalendarListPanel.tsx index b0f54b9..38bf7bd 100644 --- a/src/components/EventCalendar/EventCalendarListPanel.tsx +++ b/src/components/EventCalendar/EventCalendarListPanel.tsx @@ -26,6 +26,7 @@ import FormDateInputField from '../common/form/FormDateInputField' import { formatISODate, parseDateTime } from '../../utils/dateUtils' import { breakPoints } from '../../theme/breakPoints' import { MonthSeparator } from './MonthSeparator' +import OpenGraphMeta from '../common/OpenGraphMeta/OpenGraphMeta' const loadCalendarEventsGql = require('./graphql/loadCalendarEvents.graphql') const moreCalendarEventsGql = require('./graphql/moreCalendarEvents.graphql') @@ -74,7 +75,7 @@ const useStyles = createUseStyles({ }, }) -const PAGE_SIZE = 25 +const PAGE_SIZE = 100 type Page = Partial<{ events: CalendarEventDataFragment[] @@ -130,118 +131,130 @@ const EventCalendarListPanel = ({ initialRequiredLabelIds, initialOptionalLabelI let currentMonth = '' return ( - initialValues={initialValues} onSubmit={() => {}}> - {({ values }) => { - const refreshList = ({ - newOffset, - newFrom, - newTo, - newRequiredLabels, - newOptionalLabels, - }: { - newOffset?: number - newFrom?: Date - newTo?: Date - newRequiredLabels?: string[] - newOptionalLabels?: string[] - }) => { - setLoading(true) - client - .query({ - query: moreCalendarEventsGql, - fetchPolicy: 'network-only', - variables: { - from: formatISODate(newFrom || values.from), - to: formatISODate(newTo || values.to), - offset: newOffset !== undefined ? newOffset : offset, - limit: PAGE_SIZE, - requiredLabels: newRequiredLabels || values.requiredLabels, - optionalLabels: newOptionalLabels || values.optionalLabels, - }, - }) - .then(response => { - setPage(response.data.eventCalendar) - setLoading(false) - }) - } - - const handleOffsetChanged = (newOffset: number) => { - setOffset(newOffset) - refreshList({ newOffset }) - } - - const handleFromChanged = (newValue?: Date) => { - refreshList({ newFrom: newValue }) - } - - const handleToChanged = (newValue?: Date) => { - refreshList({ newTo: newValue }) - } - - return ( - <> - tabs={tabs} selectedTab={0} /> -
- {(!events || !requiredLabels || !optionalLabels) && } - {events && requiredLabels && optionalLabels && ( - -
- - {t('EventCalendar.gCalLink')} - - {t('EventCalendar.gCalText')} -
- - - {events.map(event => { - const lastMonth = currentMonth - currentMonth = parseDateTime(event.from).toLocaleString('cs-CZ', { - month: 'long', - year: 'numeric', - }) - return ( - - {currentMonth !== lastMonth && ( - {currentMonth} - )} - - - ) - })} - - - -
{t('EventCalendar.eventFrom')}
- -
{t('EventCalendar.eventTo')}
- - - -
-
- )} -
- - ) - }} - + <> + + initialValues={initialValues} onSubmit={() => {}}> + {({ values }) => { + const refreshList = ({ + newOffset, + newFrom, + newTo, + newRequiredLabels, + newOptionalLabels, + }: { + newOffset?: number + newFrom?: Date + newTo?: Date + newRequiredLabels?: string[] + newOptionalLabels?: string[] + }) => { + setLoading(true) + client + .query({ + query: moreCalendarEventsGql, + fetchPolicy: 'network-only', + variables: { + from: formatISODate(newFrom || values.from), + to: formatISODate(newTo || values.to), + offset: newOffset !== undefined ? newOffset : offset, + limit: PAGE_SIZE, + requiredLabels: newRequiredLabels || values.requiredLabels, + optionalLabels: newOptionalLabels || values.optionalLabels, + }, + }) + .then(response => { + setPage(response.data.eventCalendar) + setLoading(false) + }) + } + + const handleOffsetChanged = (newOffset: number) => { + setOffset(newOffset) + refreshList({ newOffset }) + } + + const handleFromChanged = (newValue?: Date) => { + refreshList({ newFrom: newValue }) + } + + const handleToChanged = (newValue?: Date) => { + refreshList({ newTo: newValue }) + } + + return ( + <> + tabs={tabs} selectedTab={0} /> +
+ {(!events || !requiredLabels || !optionalLabels) && } + {events && requiredLabels && optionalLabels && ( + +
+ + {t('EventCalendar.gCalLink')} + + {t('EventCalendar.gCalText')} +
+ + + {events.map(event => { + const lastMonth = currentMonth + const parsedDate = parseDateTime(event.from) + currentMonth = parsedDate + ? parsedDate.toLocaleString('cs-CZ', { + month: 'long', + year: 'numeric', + }) + : '???' + return ( + + {currentMonth !== lastMonth && ( + {currentMonth} + )} + + + ) + })} + + + +
+ {t('EventCalendar.eventFrom')} +
+ +
{t('EventCalendar.eventTo')}
+ + + +
+
+ )} +
+ + ) + }} + + ) } diff --git a/src/components/EventEdit/EventEditForm.tsx b/src/components/EventEdit/EventEditForm.tsx index fba676f..6794034 100644 --- a/src/components/EventEdit/EventEditForm.tsx +++ b/src/components/EventEdit/EventEditForm.tsx @@ -62,7 +62,7 @@ const EventEditForm = ({ updateEventGql, ) const loading = createLoading || updateLoading - const [formExpanded, setFormExpanded] = useState(false) + const [formExpanded, setFormExpanded] = useState(Boolean(eventId)) // Start contracted on new item, expanded one edit const handleExpandFields = () => { setFormExpanded(true) @@ -116,26 +116,11 @@ const EventEditForm = ({ - - - - - - - - + {!formExpanded && ( <>