From b58f353a5a56ed21641cd5fe1c49198da1c37904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20H=C3=A4rtel?= Date: Sun, 21 Aug 2022 12:15:22 +0200 Subject: [PATCH] Fix theme and action sheet * Action sheet moved to event tabs, styled for theme. * Badges for events put with title line to scale properly. * Use badge-inv-pad for mask requirement. * Add selection to context, move search context as event tab context. * Fix bottom sheet web issue. * Remove bottom sheet web guard. * Allow optionally transparent badges. * Adapt theme for navigation provider. * Label theme fields in documentation. * Add schedule translations. * Move event tabs context provider down the tree. --- src/App.tsx | 27 +++--- src/app/Events/EventActionsSheet.tsx | 39 +++++--- src/app/Events/EventCard.tsx | 8 +- src/app/Events/EventCardContent.tsx | 42 ++++----- src/app/Events/EventContent.tsx | 18 ++-- src/app/Events/EventsListByDayScreen.tsx | 5 + src/app/Events/EventsListByRoomScreen.tsx | 4 + src/app/Events/EventsListByTrackScreen.tsx | 4 + src/app/Events/EventsListGeneric.tsx | 62 ++++++------- .../Events/EventsListSearchResultsScreen.tsx | 5 +- src/app/Events/EventsSearchScreen.tsx | 8 +- src/app/Events/EventsSectionedListGeneric.tsx | 67 +++++++------ .../Events/EventsTabsContext.tsx} | 37 +++++--- src/app/Events/EventsTabsScreen.tsx | 93 +++++++++++-------- src/app/Events/PersonalScheduleList.tsx | 5 + src/app/Maps/MapContent.tsx | 45 +++++---- src/app/ScreenStart.tsx | 2 +- src/components/Containers/BadgeInvPad.tsx | 4 +- src/context/NavigationProvider.tsx | 23 ++++- src/context/Theme.tsx | 93 +++++++++++++++++-- src/i18n/translations.de.json | 2 + src/i18n/translations.en.json | 1 + webpack.config.js | 2 +- 23 files changed, 375 insertions(+), 221 deletions(-) rename src/{components/Searching/EventsSearchContext.tsx => app/Events/EventsTabsContext.tsx} (61%) diff --git a/src/App.tsx b/src/App.tsx index c83eb616..059ec640 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -6,7 +6,6 @@ import { PlatformBackgroundSyncManager } from "./components/Managers/BackgroundS import { PlatformNotificationReceivedManager } from "./components/Managers/NotificationReceivedManager"; import { PlatformNotificationRespondedManager } from "./components/Managers/NotificationRespondedManager"; import { PlatformTokenManager } from "./components/Managers/TokenManager"; -import { EventsSearchProvider } from "./components/Searching/EventsSearchContext"; import { SynchronizationProvider } from "./components/Synchronization/SynchronizationProvider"; import { NavigationProvider } from "./context/NavigationProvider"; @@ -17,24 +16,22 @@ export default function App() { return ( - - - + + - {/* Handle device token acquisition. */} - + {/* Handle device token acquisition. */} + - {/* Handle handling notifications in foreground. */} - - + {/* Handle handling notifications in foreground. */} + + - {/* Handle notifications in background. */} - + {/* Handle notifications in background. */} + - {/* Set up analytics. */} - - - + {/* Set up analytics. */} + + ); diff --git a/src/app/Events/EventActionsSheet.tsx b/src/app/Events/EventActionsSheet.tsx index 39e60425..1974b1f5 100644 --- a/src/app/Events/EventActionsSheet.tsx +++ b/src/app/Events/EventActionsSheet.tsx @@ -1,39 +1,54 @@ import BottomSheet, { BottomSheetScrollView } from "@gorhom/bottom-sheet"; -import { FC, useEffect, useRef } from "react"; +import { debounce } from "lodash"; +import { FC, useEffect, useMemo, useRef } from "react"; import { StyleSheet } from "react-native"; +import { useThemeBackground } from "../../context/Theme"; import { EventDetails } from "../../store/eurofurence.types"; import { EventContent } from "./EventContent"; type EventActionsSheetProps = { - eventRecord: EventDetails | undefined; + event: EventDetails | null; onClose?: () => void; }; -export const EventActionsSheet: FC = ({ eventRecord, onClose }) => { +export const EventActionsSheet: FC = ({ event, onClose }) => { const sheetRef = useRef(null); + const styleBackground = useThemeBackground("background"); + const styleHandle = useThemeBackground("inverted"); + + const close = useMemo(() => (onClose ? debounce(onClose, 100) : undefined), [onClose]); useEffect(() => { - if (eventRecord) { + if (event) { sheetRef.current?.snapToIndex(0); } else { sheetRef.current?.close(); } - }, [eventRecord]); - - if (eventRecord === undefined) { - return null; - } + }, [sheetRef, event]); return ( - - {eventRecord && } + + {!event ? null : } ); }; const styles = StyleSheet.create({ - container: { + handle: { + borderTopLeftRadius: 15, + borderTopRightRadius: 15, + }, + content: { paddingHorizontal: 30, paddingBottom: 100, }, diff --git a/src/app/Events/EventCard.tsx b/src/app/Events/EventCard.tsx index b15c8190..6993b75a 100644 --- a/src/app/Events/EventCard.tsx +++ b/src/app/Events/EventCard.tsx @@ -39,19 +39,19 @@ export const EventCard: FC = ({ type = "duration", event, onPres // Return simple label with duration text. return ( -