Skip to content

Commit 0eaaa38

Browse files
committed
Add placeholder About popup
1 parent 6070532 commit 0eaaa38

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

src/About.tsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import React from 'react';
2+
import {
3+
Button,
4+
Text,
5+
View,
6+
} from 'react-native';
7+
import {Popup} from 'react-native-windows';
8+
import {StylesContext} from './Styles';
9+
10+
type AboutPopupProps = {
11+
show: boolean;
12+
close: () => void;
13+
}
14+
function AboutPopup({show, close}: AboutPopupProps): JSX.Element {
15+
const styles = React.useContext(StylesContext);
16+
17+
return (
18+
<Popup
19+
isOpen={show}
20+
isLightDismissEnabled={true}
21+
onDismiss={() => close()}>
22+
<View style={[styles.feedbackDialog, {gap: 12}]}>
23+
<View style={{flexDirection: 'row', marginBottom: 4}}>
24+
<View style={{backgroundColor: 'gray', borderRadius: 4, marginRight: 4}}>
25+
<Text></Text>
26+
</View>
27+
<Text style={{fontWeight: 'bold'}}>About</Text>
28+
</View>
29+
<View style={{marginTop: 12, alignSelf: 'flex-end'}}>
30+
<Button
31+
title="OK"
32+
onPress={() => {
33+
close();
34+
}}/>
35+
</View>
36+
</View>
37+
</Popup>
38+
);
39+
}
40+
41+
export { AboutPopup }

src/Chat.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
FeedbackPopup,
1515
} from './Feedback';
1616
import { SettingsPopup } from './Settings';
17+
import { AboutPopup } from './About';
1718
import { HoverButton } from './Controls';
1819

1920
enum ChatSource {
@@ -104,9 +105,12 @@ function Chat({entries, humanText, onPrompt, clearConversation}: ChatProps): JSX
104105
const chatHistory = React.useContext(ChatHistoryContext);
105106
const [showFeedbackPopup, setShowFeedbackPopup] = React.useState(false);
106107
const [showSettingsPopup, setShowSettingsPopup] = React.useState(false);
108+
const [showAboutPopup, setShowAboutPopup] = React.useState(false);
107109
const [feedbackIsPositive, setFeedbackIsPositive] = React.useState(false);
108110
const scrollViewRef : React.RefObject<ScrollView> = React.useRef(null);
109111

112+
let showingAnyPopups = (showFeedbackPopup || showSettingsPopup || showAboutPopup);
113+
110114
const feedbackContext = {
111115
showFeedback: (positive: boolean) => {
112116
setFeedbackIsPositive(positive);
@@ -174,7 +178,7 @@ function Chat({entries, humanText, onPrompt, clearConversation}: ChatProps): JSX
174178
disableCopy={true}
175179
contentShownOnHover={
176180
<>
177-
<HoverButton content="❔" tooltip="About" onPress={() => console.log("About dialog: Not yet implemented")}/>
181+
<HoverButton content="❔" tooltip="About" onPress={() => setShowAboutPopup(true)}/>
178182
<HoverButton content="⚙️" tooltip="Settings" onPress={() => setShowSettingsPopup(true)}/>
179183
</>
180184
}>
@@ -187,14 +191,17 @@ function Chat({entries, humanText, onPrompt, clearConversation}: ChatProps): JSX
187191
clearConversation={clearConversation}/>
188192
</HumanSection>
189193
</View>
190-
{ (showFeedbackPopup || showSettingsPopup) && <View style={styles.popupBackground}/> }
194+
{ showingAnyPopups && <View style={styles.popupBackground}/> }
191195
<FeedbackPopup
192196
show={showFeedbackPopup}
193197
isPositive={feedbackIsPositive}
194198
close={() => setShowFeedbackPopup(false)}/>
195199
<SettingsPopup
196200
show={showSettingsPopup}
197201
close={() => setShowSettingsPopup(false)}/>
202+
<AboutPopup
203+
show={showAboutPopup}
204+
close={() => setShowAboutPopup(false)}/>
198205
</View>
199206
</ChatScrollContext.Provider>
200207
</FeedbackContext.Provider>

0 commit comments

Comments
 (0)