From 5e6bba0209b861392d07c24fc460c2bc1ed4b1eb Mon Sep 17 00:00:00 2001 From: Pavel Torbeev Date: Sun, 27 Aug 2023 07:13:54 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BF=D0=BE=20=D0=BC=D0=B5=D0=BB=D0=BE=D1=87=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/routes/routes.ts | 2 +- src/pages/deck/DeckPage.tsx | 10 ++++++++-- src/pages/deck/document/slides/Slide7.tsx | 13 +++++++++++++ src/pages/deck/document/slides/Slide9.tsx | 4 ++-- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/app/routes/routes.ts b/src/app/routes/routes.ts index 7a216f0..a61f5c0 100644 --- a/src/app/routes/routes.ts +++ b/src/app/routes/routes.ts @@ -1,4 +1,4 @@ -export const CHAT_PAGE_ROUTE = `/chat`; +export const CHAT_PAGE_ROUTE = `/`; export const DECK_PAGE_PARAM = 'deckId'; export const DECK_PAGE_ROUTE = `/deck/:${DECK_PAGE_PARAM}`; diff --git a/src/pages/deck/DeckPage.tsx b/src/pages/deck/DeckPage.tsx index 5a5d55c..7ae1f75 100644 --- a/src/pages/deck/DeckPage.tsx +++ b/src/pages/deck/DeckPage.tsx @@ -14,11 +14,12 @@ import {generateGrowChart} from './document/media/generateGrowChart'; export const DeckPage: ReactFCC = () => { const deckId = useUrlParam(DECK_PAGE_PARAM, {parser: parseInt}); - // todo поставить таумаут искуственно + const [enabled, setEnabled] = useState(false); + const { data } = useDeck({ deckId: deckId ?? 0, config: { - enabled: !!deckId + enabled: !!deckId && enabled } }); @@ -63,6 +64,11 @@ export const DeckPage: ReactFCC = () => { ); }, [data]); + useEffect(() => { + setTimeout(() => { + setEnabled(true) + }, 2000); + }, []); return (
diff --git a/src/pages/deck/document/slides/Slide7.tsx b/src/pages/deck/document/slides/Slide7.tsx index e28811c..a361006 100644 --- a/src/pages/deck/document/slides/Slide7.tsx +++ b/src/pages/deck/document/slides/Slide7.tsx @@ -3,6 +3,7 @@ import {Image, Page, StyleSheet, Text, View} from '@react-pdf/renderer'; import {bgColor, pageFontStyles, primaryColor, subtitleStyles, titleStyles} from '../shared'; import {GetDeckResponse} from '../../../../api/deck/getDeck'; import {ExtractArray} from '../../../../utils/types'; +import {BACKEND_URL} from '../../../../config'; export interface Slide7Props { data: ExtractArray['data']; @@ -35,12 +36,20 @@ const styles = StyleSheet.create({ subtitle: { ...subtitleStyles }, + image: { + margin: '0 auto', + width: 400, + height: 400, + objectFit: 'contain' + } }); export const Slide7: ReactFCC = (props) => { const { data } = props; const money = data.find((i) => i.slug === 'money')?.answer as string; + const finance_model = data.find((i) => i.slug === 'finance_model')?.photos + const url = finance_model?.[0] ? BACKEND_URL + finance_model[0] : undefined; return ( @@ -49,6 +58,10 @@ export const Slide7: ReactFCC = (props) => { {money} + + {url && ( + + )} ) diff --git a/src/pages/deck/document/slides/Slide9.tsx b/src/pages/deck/document/slides/Slide9.tsx index b8c0d88..231f309 100644 --- a/src/pages/deck/document/slides/Slide9.tsx +++ b/src/pages/deck/document/slides/Slide9.tsx @@ -1,6 +1,6 @@ import {ReactFCC} from '../../../../utils/ReactFCC'; import {Image, Page, StyleSheet, Text, View} from '@react-pdf/renderer'; -import {bgColor, pageFontStyles, primaryColor, secondaryColor, titleStyles} from '../shared'; +import {bgColor, pageFontStyles, primaryColor, titleStyles} from '../shared'; import {GetDeckResponse} from '../../../../api/deck/getDeck'; import {ExtractArray} from '../../../../utils/types'; import {BACKEND_URL} from '../../../../config'; @@ -29,7 +29,6 @@ const styles = StyleSheet.create({ margin: '8px 0 16px' }, text: { - width: '100%', fontSize: '16px', }, map: { @@ -43,6 +42,7 @@ const styles = StyleSheet.create({ display: 'flex', flexDirection: 'column', gap: 16, + width: 200, }, image: { width: 200,