From 46944a44878825ac393c4e71cc307a667e6a6714 Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Tue, 11 May 2021 09:08:05 +0200 Subject: [PATCH] show event color in popup --- src/components/Dialogs/AlertDialog.tsx | 8 +++++++- src/screens/Planex/PlanexScreen.tsx | 14 ++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/components/Dialogs/AlertDialog.tsx b/src/components/Dialogs/AlertDialog.tsx index 9962a39..9465df5 100644 --- a/src/components/Dialogs/AlertDialog.tsx +++ b/src/components/Dialogs/AlertDialog.tsx @@ -20,18 +20,24 @@ import * as React from 'react'; import { Button, Dialog, Paragraph, Portal } from 'react-native-paper'; import i18n from 'i18n-js'; +import { ViewStyle } from 'react-native'; type PropsType = { visible: boolean; onDismiss: () => void; title: string | React.ReactNode; message: string | React.ReactNode; + style?: ViewStyle; }; function AlertDialog(props: PropsType) { return ( - + {props.title} {props.message} diff --git a/src/screens/Planex/PlanexScreen.tsx b/src/screens/Planex/PlanexScreen.tsx index f58102f..3596639 100644 --- a/src/screens/Planex/PlanexScreen.tsx +++ b/src/screens/Planex/PlanexScreen.tsx @@ -160,6 +160,7 @@ function PlanexScreen(props: Props) { | { title: string | React.ReactElement; message: string | React.ReactElement; + color: string; } >(); const [injectJS, setInjectJS] = useState(''); @@ -269,7 +270,7 @@ function PlanexScreen(props: Props) { if (startString != null && endString != null) { msg += `${startString} - ${endString}`; } - showDialog(data.title, msg); + showDialog(data.title, msg, data.color); }; /** @@ -278,7 +279,8 @@ function PlanexScreen(props: Props) { * @param title The dialog's title * @param message The message to show */ - const showDialog = (title: string, message: string) => { + const showDialog = (title: string, message: string, color?: string) => { + const finalColor = color ? color : theme.colors.surface; setDialogContent({ title: ( ), message: message, + color: finalColor, }); }; @@ -329,8 +332,6 @@ function PlanexScreen(props: Props) { * @param groupID The current group selected */ const generateInjectedJS = (group: PlanexGroupType | undefined) => { - console.log(group); - let customInjectedJS = `$(document).ready(function() { ${OBSERVE_MUTATIONS_INJECTED} ${INJECT_STYLE} @@ -386,6 +387,11 @@ function PlanexScreen(props: Props) { onDismiss={hideDialog} title={dialogContent ? dialogContent.title : ''} message={dialogContent ? dialogContent.message : ''} + style={ + dialogContent + ? { borderColor: dialogContent.color, borderWidth: 2 } + : undefined + } />