From 49cdd441e03f4992d4b093eb94a42e01ff4a91c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?B=C3=A1lint=20Berente?=
<30603208+berenteb@users.noreply.github.com>
Date: Sun, 25 Feb 2024 15:21:59 +0100
Subject: [PATCH 1/7] feat: qna bubbles and screen
---
app/(tabs)/home/qna.tsx | 3 ++
app/(tabs)/presentation/qna.tsx | 3 ++
components/base/scroll-content.tsx | 2 +-
components/common/header.tsx | 2 +-
components/qna/qna-answer.tsx | 15 ++++++++
components/qna/qna-question.tsx | 15 ++++++++
components/qna/qna-screen.tsx | 34 +++++++++++++++++++
.../schedule/elements/favorite-button.tsx | 2 +-
components/schedule/elements/qna-button.tsx | 22 ++++++++++++
.../layouts/presentation-details-page.tsx | 10 +++++-
hooks/use-questions.ts | 18 ++++++++++
theme/extendedColors.ts | 2 +-
12 files changed, 123 insertions(+), 5 deletions(-)
create mode 100644 app/(tabs)/home/qna.tsx
create mode 100644 app/(tabs)/presentation/qna.tsx
create mode 100644 components/qna/qna-answer.tsx
create mode 100644 components/qna/qna-question.tsx
create mode 100644 components/qna/qna-screen.tsx
create mode 100644 components/schedule/elements/qna-button.tsx
create mode 100644 hooks/use-questions.ts
diff --git a/app/(tabs)/home/qna.tsx b/app/(tabs)/home/qna.tsx
new file mode 100644
index 0000000..cfdda46
--- /dev/null
+++ b/app/(tabs)/home/qna.tsx
@@ -0,0 +1,3 @@
+import { QnaScreen } from '../../../components/qna/qna-screen';
+
+export default QnaScreen;
diff --git a/app/(tabs)/presentation/qna.tsx b/app/(tabs)/presentation/qna.tsx
new file mode 100644
index 0000000..cfdda46
--- /dev/null
+++ b/app/(tabs)/presentation/qna.tsx
@@ -0,0 +1,3 @@
+import { QnaScreen } from '../../../components/qna/qna-screen';
+
+export default QnaScreen;
diff --git a/components/base/scroll-content.tsx b/components/base/scroll-content.tsx
index bc1ad32..ab55f89 100644
--- a/components/base/scroll-content.tsx
+++ b/components/base/scroll-content.tsx
@@ -10,6 +10,6 @@ export function ScrollContent({ className, ...props }: ScrollViewProps) {
paddingBottom: 130,
}}
{...props}
- >
+ />
);
}
diff --git a/components/common/header.tsx b/components/common/header.tsx
index ff88662..09d6698 100644
--- a/components/common/header.tsx
+++ b/components/common/header.tsx
@@ -22,7 +22,7 @@ export function Header({ children, className, corner, ...props }: HeaderProps) {
)}
- {corner}
+ {corner}
)}
{children}
diff --git a/components/qna/qna-answer.tsx b/components/qna/qna-answer.tsx
new file mode 100644
index 0000000..02fd379
--- /dev/null
+++ b/components/qna/qna-answer.tsx
@@ -0,0 +1,15 @@
+import { View } from 'react-native';
+
+import { StyledText } from '../base/text';
+
+interface QnaAnswerProps {
+ answer: string;
+}
+
+export function QnaAnswer({ answer }: QnaAnswerProps) {
+ return (
+
+ {answer}
+
+ );
+}
diff --git a/components/qna/qna-question.tsx b/components/qna/qna-question.tsx
new file mode 100644
index 0000000..7c5b888
--- /dev/null
+++ b/components/qna/qna-question.tsx
@@ -0,0 +1,15 @@
+import { View } from 'react-native';
+
+import { StyledText } from '../base/text';
+
+interface QnaQuestionProps {
+ question: string;
+}
+
+export function QnaQuestion({ question }: QnaQuestionProps) {
+ return (
+
+ {question}
+
+ );
+}
diff --git a/components/qna/qna-screen.tsx b/components/qna/qna-screen.tsx
new file mode 100644
index 0000000..d637e58
--- /dev/null
+++ b/components/qna/qna-screen.tsx
@@ -0,0 +1,34 @@
+import { usePresentation } from '../../hooks/use-presentation';
+import { useQuestions } from '../../hooks/use-questions';
+import { useSafeId } from '../../utils/common.utils';
+import { Screen } from '../base/screen';
+import { ScrollContent } from '../base/scroll-content';
+import { Header } from '../common/header';
+import { SkeletonTitle } from '../common/skeletons/skeleton-title';
+import { Subtitle } from '../common/subtitle';
+import { Title } from '../common/title';
+import { QnaAnswer } from './qna-answer';
+import { QnaQuestion } from './qna-question';
+
+export function QnaScreen() {
+ const id = useSafeId();
+ const presentation = usePresentation(id);
+ const question = useQuestions();
+ return (
+
+
+ Kérdés küldése
+ {presentation.isLoading && }
+ {presentation.data && {presentation.data.title}}
+
+
+ {question.data && (
+ <>
+
+
+ >
+ )}
+
+
+ );
+}
diff --git a/components/schedule/elements/favorite-button.tsx b/components/schedule/elements/favorite-button.tsx
index 59ddcf5..dd37c35 100644
--- a/components/schedule/elements/favorite-button.tsx
+++ b/components/schedule/elements/favorite-button.tsx
@@ -24,7 +24,7 @@ export function FavoriteButton({ presentation }: FavoriteButtonProps) {
};
return (
-
+
>();
+ const onPress = () => {
+ router.navigate('qna', { id: slug });
+ };
+ return (
+
+
+
+ );
+}
diff --git a/components/schedule/layouts/presentation-details-page.tsx b/components/schedule/layouts/presentation-details-page.tsx
index 6b214a5..f4c4389 100644
--- a/components/schedule/layouts/presentation-details-page.tsx
+++ b/components/schedule/layouts/presentation-details-page.tsx
@@ -9,6 +9,7 @@ import { SkeletonTitle } from '../../common/skeletons/skeleton-title';
import { Subtitle } from '../../common/subtitle';
import { Title } from '../../common/title';
import { FavoriteButton } from '../elements/favorite-button';
+import { QnaButton } from '../elements/qna-button';
interface ScheduleDetailsPageProps {
slug: string;
@@ -20,7 +21,14 @@ export function PresentationDetailsPage({ slug }: ScheduleDetailsPageProps) {
const endTime = ConferenceService.getFormattedTimestamp(data?.endTime ?? '');
return (
- : undefined}>
+
+ {data && }
+
+ >
+ }
+ >
{isLoading && }
{data && (
<>
diff --git a/hooks/use-questions.ts b/hooks/use-questions.ts
new file mode 100644
index 0000000..0d54acd
--- /dev/null
+++ b/hooks/use-questions.ts
@@ -0,0 +1,18 @@
+import { useQuery } from '@tanstack/react-query';
+
+type QuestionDto = {
+ text: string;
+};
+
+export function useQuestions() {
+ return useQuery({
+ queryKey: ['questions'],
+ queryFn: async () => {
+ return [
+ {
+ text: 'What is the meaning of life? Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
+ },
+ ];
+ },
+ });
+}
diff --git a/theme/extendedColors.ts b/theme/extendedColors.ts
index 64217d1..756a508 100644
--- a/theme/extendedColors.ts
+++ b/theme/extendedColors.ts
@@ -4,7 +4,7 @@ import tailwindConfig from '../tailwind.config';
const fullConfig = resolveConfig(tailwindConfig);
-export const extendedColors = {
+export const extendedColors: Record> = {
primary: {
100: '#f5f1cc',
200: '#ebe299',
From a0d12a3b84a57b276e253db216b3cab726bf4756 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?B=C3=A1lint=20Berente?=
<30603208+berenteb@users.noreply.github.com>
Date: Sun, 25 Feb 2024 15:59:09 +0100
Subject: [PATCH 2/7] feat: qna input
---
components/common/styled-button.tsx | 8 +++++--
components/qna/input.tsx | 37 +++++++++++++++++++++++++++++
components/qna/qna-screen.tsx | 4 +++-
utils/keyboard.utils.ts | 23 ++++++++++++++++++
4 files changed, 69 insertions(+), 3 deletions(-)
create mode 100644 components/qna/input.tsx
create mode 100644 utils/keyboard.utils.ts
diff --git a/components/common/styled-button.tsx b/components/common/styled-button.tsx
index 54d11bc..2fb4bd6 100644
--- a/components/common/styled-button.tsx
+++ b/components/common/styled-button.tsx
@@ -19,7 +19,7 @@ const textStyles: Record = {
};
interface StyledButtonProps extends Omit {
- children: string;
+ children?: string;
leftIcon?: React.ComponentProps['name'];
rightIcon?: React.ComponentProps['name'];
variant?: keyof typeof buttonStyles;
@@ -43,7 +43,11 @@ const StyledButton = forwardRef(
{leftIcon && (
)}
- {children}
+ {children && (
+
+ {children}
+
+ )}
{rightIcon && (
)}
diff --git a/components/qna/input.tsx b/components/qna/input.tsx
new file mode 100644
index 0000000..0e4cb89
--- /dev/null
+++ b/components/qna/input.tsx
@@ -0,0 +1,37 @@
+import { TextInput, View } from 'react-native';
+
+import { extendedColors } from '../../theme/extendedColors';
+import { useKeyboardOffset } from '../../utils/keyboard.utils';
+import { StyledButton } from '../common/styled-button';
+
+interface InputProps {
+ placeholder: string;
+ onSubmit: (text: string) => void;
+ disabled?: boolean;
+}
+
+export function Input({ placeholder, onSubmit, disabled = false }: InputProps) {
+ const keyboardOffset = useKeyboardOffset();
+ return (
+
+ onSubmit(e.nativeEvent.text)}
+ editable={!disabled}
+ />
+
+
+ );
+}
diff --git a/components/qna/qna-screen.tsx b/components/qna/qna-screen.tsx
index d637e58..e972357 100644
--- a/components/qna/qna-screen.tsx
+++ b/components/qna/qna-screen.tsx
@@ -7,6 +7,7 @@ import { Header } from '../common/header';
import { SkeletonTitle } from '../common/skeletons/skeleton-title';
import { Subtitle } from '../common/subtitle';
import { Title } from '../common/title';
+import { Input } from './input';
import { QnaAnswer } from './qna-answer';
import { QnaQuestion } from './qna-question';
@@ -21,7 +22,7 @@ export function QnaScreen() {
{presentation.isLoading && }
{presentation.data && {presentation.data.title}}
-
+
{question.data && (
<>
@@ -29,6 +30,7 @@ export function QnaScreen() {
>
)}
+ console.log(text)} />
);
}
diff --git a/utils/keyboard.utils.ts b/utils/keyboard.utils.ts
new file mode 100644
index 0000000..e64e05b
--- /dev/null
+++ b/utils/keyboard.utils.ts
@@ -0,0 +1,23 @@
+import { useEffect, useRef, useState } from 'react';
+import { EmitterSubscription, Keyboard } from 'react-native';
+
+export function useKeyboardOffset() {
+ const [keyboardOffset, setKeyboardOffset] = useState(0);
+ const onKeyboardShow = (event: { endCoordinates: { height: React.SetStateAction } }) =>
+ setKeyboardOffset(event.endCoordinates.height);
+ const onKeyboardHide = () => setKeyboardOffset(0);
+ const keyboardDidShowListener = useRef();
+ const keyboardDidHideListener = useRef();
+
+ useEffect(() => {
+ keyboardDidShowListener.current = Keyboard.addListener('keyboardWillShow', onKeyboardShow);
+ keyboardDidHideListener.current = Keyboard.addListener('keyboardWillHide', onKeyboardHide);
+
+ return () => {
+ keyboardDidShowListener.current?.remove();
+ keyboardDidHideListener.current?.remove();
+ };
+ }, []);
+
+ return keyboardOffset;
+}
From 730bd56f1067968bd057a8a46db1ffd8cd406686 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?B=C3=A1lint=20Berente?=
<30603208+berenteb@users.noreply.github.com>
Date: Sun, 25 Feb 2024 23:31:16 +0100
Subject: [PATCH 3/7] feat: qna messaging and animations
---
components/base/screen.tsx | 2 +-
components/base/scroll-content.tsx | 31 ++++++++++-------
components/qna/input.tsx | 18 ++++++++--
components/qna/qna-answer.tsx | 35 ++++++++++++++++----
components/qna/qna-question.tsx | 35 ++++++++++++++++----
components/qna/qna-screen.tsx | 35 +++++++++++++++-----
hooks/use-messaging.ts | 53 ++++++++++++++++++++++++++++++
types/qna.type.ts | 6 ++++
8 files changed, 180 insertions(+), 35 deletions(-)
create mode 100644 hooks/use-messaging.ts
create mode 100644 types/qna.type.ts
diff --git a/components/base/screen.tsx b/components/base/screen.tsx
index 7ba6d9a..3eadf42 100644
--- a/components/base/screen.tsx
+++ b/components/base/screen.tsx
@@ -9,5 +9,5 @@ interface ScreenProps extends ViewProps {
export function Screen({ className, analyticsScreenName, ...props }: ScreenProps) {
usePageView(analyticsScreenName);
- return ;
+ return ;
}
diff --git a/components/base/scroll-content.tsx b/components/base/scroll-content.tsx
index ab55f89..f3bcc64 100644
--- a/components/base/scroll-content.tsx
+++ b/components/base/scroll-content.tsx
@@ -1,15 +1,24 @@
-import { ScrollView, ScrollViewProps } from 'react-native';
+import { forwardRef } from 'react';
+import { ScrollView, ScrollViewProps, ViewStyle } from 'react-native';
import { cn } from '../../utils/common.utils';
-export function ScrollContent({ className, ...props }: ScrollViewProps) {
- return (
-
- );
+interface ScrollContentProps extends ScrollViewProps {
+ className?: string;
+ contentContainerStyle?: ViewStyle;
}
+
+const ScrollContent = forwardRef(
+ ({ className, contentContainerStyle, ...props }, ref) => {
+ return (
+
+ );
+ }
+);
+
+export { ScrollContent };
diff --git a/components/qna/input.tsx b/components/qna/input.tsx
index 0e4cb89..de4d87a 100644
--- a/components/qna/input.tsx
+++ b/components/qna/input.tsx
@@ -1,3 +1,4 @@
+import { useRef, useState } from 'react';
import { TextInput, View } from 'react-native';
import { extendedColors } from '../../theme/extendedColors';
@@ -10,8 +11,18 @@ interface InputProps {
disabled?: boolean;
}
+const MIN_CHARACTERS_TO_SEND = 5;
+
export function Input({ placeholder, onSubmit, disabled = false }: InputProps) {
+ const ref = useRef(null);
+ const [value, setValue] = useState('');
const keyboardOffset = useKeyboardOffset();
+ const onSend = () => {
+ if (value.length < MIN_CHARACTERS_TO_SEND) return;
+ ref.current?.clear();
+ onSubmit(value);
+ setValue('');
+ };
return (
onSubmit(e.nativeEvent.text)}
+ value={value}
+ onChange={(e) => setValue(e.nativeEvent.text)}
+ onSubmitEditing={onSend}
editable={!disabled}
/>
-
+
);
}
diff --git a/components/qna/qna-answer.tsx b/components/qna/qna-answer.tsx
index 02fd379..142997c 100644
--- a/components/qna/qna-answer.tsx
+++ b/components/qna/qna-answer.tsx
@@ -1,15 +1,38 @@
-import { View } from 'react-native';
+import { useEffect } from 'react';
+import { Animated } from 'react-native';
+import { QnaMessage } from '../../types/qna.type';
+import { useAnimated } from '../../utils/animation.utils';
import { StyledText } from '../base/text';
interface QnaAnswerProps {
- answer: string;
+ message: QnaMessage;
}
-export function QnaAnswer({ answer }: QnaAnswerProps) {
+export function QnaAnswer({ message }: QnaAnswerProps) {
+ const { value, forward } = useAnimated();
+ useEffect(() => {
+ if (!message.isInitial) forward();
+ }, []);
return (
-
- {answer}
-
+
+ {message.text}
+
);
}
diff --git a/components/qna/qna-question.tsx b/components/qna/qna-question.tsx
index 7c5b888..6ed4494 100644
--- a/components/qna/qna-question.tsx
+++ b/components/qna/qna-question.tsx
@@ -1,15 +1,38 @@
-import { View } from 'react-native';
+import { useEffect } from 'react';
+import { Animated } from 'react-native';
+import { QnaMessage } from '../../types/qna.type';
+import { useAnimated } from '../../utils/animation.utils';
import { StyledText } from '../base/text';
interface QnaQuestionProps {
- question: string;
+ message: QnaMessage;
}
-export function QnaQuestion({ question }: QnaQuestionProps) {
+export function QnaQuestion({ message }: QnaQuestionProps) {
+ const { value, forward } = useAnimated();
+ useEffect(() => {
+ if (!message.isInitial) forward();
+ }, []);
return (
-
- {question}
-
+
+ {message.text}
+
);
}
diff --git a/components/qna/qna-screen.tsx b/components/qna/qna-screen.tsx
index e972357..ba80e4d 100644
--- a/components/qna/qna-screen.tsx
+++ b/components/qna/qna-screen.tsx
@@ -1,5 +1,8 @@
+import { useEffect, useRef } from 'react';
+import { ScrollView } from 'react-native';
+
+import { useMessaging } from '../../hooks/use-messaging';
import { usePresentation } from '../../hooks/use-presentation';
-import { useQuestions } from '../../hooks/use-questions';
import { useSafeId } from '../../utils/common.utils';
import { Screen } from '../base/screen';
import { ScrollContent } from '../base/scroll-content';
@@ -12,9 +15,16 @@ import { QnaAnswer } from './qna-answer';
import { QnaQuestion } from './qna-question';
export function QnaScreen() {
+ const ref = useRef(null);
const id = useSafeId();
const presentation = usePresentation(id);
- const question = useQuestions();
+ const messaging = useMessaging();
+ useEffect(() => {
+ const timeout = setTimeout(() => {
+ ref.current?.scrollToEnd({ animated: true });
+ }, 1);
+ return () => clearTimeout(timeout);
+ }, [messaging.messages]);
return (
@@ -22,15 +32,22 @@ export function QnaScreen() {
{presentation.isLoading && }
{presentation.data && {presentation.data.title}}
-
- {question.data && (
- <>
-
-
- >
+
+ {messaging.messages.map((message, index) =>
+ message.kind === 'question' ? (
+
+ ) : (
+
+ )
)}
- console.log(text)} />
+
);
}
diff --git a/hooks/use-messaging.ts b/hooks/use-messaging.ts
new file mode 100644
index 0000000..e957e2e
--- /dev/null
+++ b/hooks/use-messaging.ts
@@ -0,0 +1,53 @@
+import { useState } from 'react';
+
+import { QnaMessage } from '../types/qna.type';
+
+export function useMessaging() {
+ const [messages, setMessages] = useState([]);
+
+ const addMessage = (newMessage: QnaMessage) => {
+ setMessages((prevMessages) => [...prevMessages, newMessage]);
+ };
+
+ const updateMessage = (message: QnaMessage) => {
+ setMessages((prevMessages) => prevMessages.map((prevMessage) => (prevMessage === message ? message : prevMessage)));
+ };
+
+ const addAnswer = (answerText: string) => {
+ const newMessage: QnaMessage = {
+ kind: 'answer',
+ text: answerText,
+ isInitial: false,
+ status: 'sent',
+ };
+ addMessage(newMessage);
+ };
+
+ const sendMessageText = async (messageText: string) => {
+ const newMessage: QnaMessage = {
+ kind: 'question',
+ text: messageText,
+ isInitial: false,
+ status: 'pending',
+ };
+ addMessage(newMessage);
+ sendMessage(newMessage)
+ .then(() => {
+ updateMessage({ ...newMessage, status: 'sent' });
+ addAnswer('Kérdésed megkaptuk és moderálás után a felolvasandó kérdések közé kerül. Köszönjük!');
+ })
+ .catch(() => {
+ updateMessage({ ...newMessage, status: 'error' });
+ });
+ };
+
+ return { messages, sendMessageText };
+}
+
+async function sendMessage(message: QnaMessage) {
+ return await new Promise((resolve) => {
+ setTimeout(() => {
+ resolve(message);
+ }, 2000);
+ });
+}
diff --git a/types/qna.type.ts b/types/qna.type.ts
new file mode 100644
index 0000000..fa22050
--- /dev/null
+++ b/types/qna.type.ts
@@ -0,0 +1,6 @@
+export type QnaMessage = {
+ kind: 'question' | 'answer';
+ text: string;
+ isInitial: boolean;
+ status: 'pending' | 'sent' | 'error';
+};
From b8d1891cdb689572a59794686786a30c50ba1125 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?B=C3=A1lint=20Berente?=
<30603208+berenteb@users.noreply.github.com>
Date: Sun, 25 Feb 2024 23:36:25 +0100
Subject: [PATCH 4/7] feat: inout disable below minimum characters
---
components/common/styled-button.tsx | 5 ++++-
components/qna/input.tsx | 8 +++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/components/common/styled-button.tsx b/components/common/styled-button.tsx
index 2fb4bd6..d38a2aa 100644
--- a/components/common/styled-button.tsx
+++ b/components/common/styled-button.tsx
@@ -26,7 +26,7 @@ interface StyledButtonProps extends Omit {
}
const StyledButton = forwardRef(
- ({ children, variant = 'primary', leftIcon, rightIcon, className, ...props }, ref) => {
+ ({ children, variant = 'primary', leftIcon, rightIcon, className, disabled, ...props }, ref) => {
return (
(
'px-4',
'py-2',
'items-center justify-center flex-row space-x-2',
+ {
+ 'opacity-50': disabled,
+ },
className
)}
ref={ref}
diff --git a/components/qna/input.tsx b/components/qna/input.tsx
index de4d87a..c0d9811 100644
--- a/components/qna/input.tsx
+++ b/components/qna/input.tsx
@@ -23,6 +23,7 @@ export function Input({ placeholder, onSubmit, disabled = false }: InputProps) {
onSubmit(value);
setValue('');
};
+ const isDisabled = value.length < MIN_CHARACTERS_TO_SEND || disabled;
return (
-
+
);
}
From be2c2bea630c941f5ebaeadec5385b7d0cbb4f1e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?B=C3=A1lint=20Berente?=
<30603208+berenteb@users.noreply.github.com>
Date: Sun, 25 Feb 2024 23:48:02 +0100
Subject: [PATCH 5/7] feat: question count limit
---
components/qna/qna-screen.tsx | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/components/qna/qna-screen.tsx b/components/qna/qna-screen.tsx
index ba80e4d..812c344 100644
--- a/components/qna/qna-screen.tsx
+++ b/components/qna/qna-screen.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useRef } from 'react';
+import { useEffect, useMemo, useRef } from 'react';
import { ScrollView } from 'react-native';
import { useMessaging } from '../../hooks/use-messaging';
@@ -14,17 +14,28 @@ import { Input } from './input';
import { QnaAnswer } from './qna-answer';
import { QnaQuestion } from './qna-question';
+const MAX_QUESTION_COUNT = 3;
+
export function QnaScreen() {
const ref = useRef(null);
const id = useSafeId();
const presentation = usePresentation(id);
const messaging = useMessaging();
+
useEffect(() => {
const timeout = setTimeout(() => {
ref.current?.scrollToEnd({ animated: true });
}, 1);
return () => clearTimeout(timeout);
}, [messaging.messages]);
+
+ const questionCount = useMemo(
+ () => messaging.messages.filter((message) => message.kind === 'question').length,
+ [messaging.messages]
+ );
+
+ const remainingQuestions = MAX_QUESTION_COUNT - questionCount;
+
return (
);
}
From 663288d07f07b08b2b3ab8785e46c912f7c3a323 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?B=C3=A1lint=20Berente?=
<30603208+berenteb@users.noreply.github.com>
Date: Mon, 26 Feb 2024 19:15:08 +0100
Subject: [PATCH 6/7] feat: qna internationalization
---
components/qna/qna-screen.tsx | 8 +++++---
services/i18n_data.ts | 10 ++++++++++
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/components/qna/qna-screen.tsx b/components/qna/qna-screen.tsx
index 812c344..238e136 100644
--- a/components/qna/qna-screen.tsx
+++ b/components/qna/qna-screen.tsx
@@ -1,4 +1,5 @@
import { useEffect, useMemo, useRef } from 'react';
+import { useTranslation } from 'react-i18next';
import { ScrollView } from 'react-native';
import { useMessaging } from '../../hooks/use-messaging';
@@ -14,9 +15,10 @@ import { Input } from './input';
import { QnaAnswer } from './qna-answer';
import { QnaQuestion } from './qna-question';
-const MAX_QUESTION_COUNT = 3;
+const MAX_QUESTION_COUNT = Infinity;
export function QnaScreen() {
+ const { t } = useTranslation();
const ref = useRef(null);
const id = useSafeId();
const presentation = usePresentation(id);
@@ -39,7 +41,7 @@ export function QnaScreen() {
return (
- Kérdés küldése
+ {t('qna.title')}
{presentation.isLoading && }
{presentation.data && {presentation.data.title}}
@@ -60,7 +62,7 @@ export function QnaScreen() {
diff --git a/services/i18n_data.ts b/services/i18n_data.ts
index 80dd424..5588bcc 100644
--- a/services/i18n_data.ts
+++ b/services/i18n_data.ts
@@ -38,6 +38,11 @@ export const resources = {
sub: 'Please contact the developers',
retry: 'Retry',
},
+ qna: {
+ title: 'Send a question',
+ remainingQuestions: 'remaining',
+ placeholder: 'Type a question!',
+ },
},
},
hu: {
@@ -79,6 +84,11 @@ export const resources = {
sub: 'Kérlek ezt jelezd a fejlesztőknek!',
retry: 'Újrapróbálkozás',
},
+ qna: {
+ title: 'Kérdés küldése',
+ remainingQuestions: 'maradt',
+ placeholder: 'Írj egy kérdést!',
+ },
},
},
};
From 63584548d0fc00143c0c1fd6121ba9a74dd7e5dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?B=C3=A1lint=20Berente?=
<30603208+berenteb@users.noreply.github.com>
Date: Tue, 27 Feb 2024 18:37:46 +0100
Subject: [PATCH 7/7] fix: presentation sort
---
services/conference.service.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/services/conference.service.ts b/services/conference.service.ts
index 3b804cf..2b27e1c 100644
--- a/services/conference.service.ts
+++ b/services/conference.service.ts
@@ -15,10 +15,10 @@ export class ConferenceService {
const aStartDate = new Date(a.startTime);
const bStartDate = new Date(b.startTime);
if (isBefore(aStartDate, bStartDate)) {
- return 1;
+ return -1;
}
if (isAfter(aStartDate, bStartDate)) {
- return -1;
+ return 1;
}
return 0;
});