Поправил по мелочи

This commit is contained in:
Pavel Torbeev 2023-08-27 07:13:54 +03:00
parent 59fae98030
commit 5e6bba0209
4 changed files with 24 additions and 5 deletions

View File

@ -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_PARAM = 'deckId';
export const DECK_PAGE_ROUTE = `/deck/:${DECK_PAGE_PARAM}`; export const DECK_PAGE_ROUTE = `/deck/:${DECK_PAGE_PARAM}`;

View File

@ -14,11 +14,12 @@ import {generateGrowChart} from './document/media/generateGrowChart';
export const DeckPage: ReactFCC = () => { export const DeckPage: ReactFCC = () => {
const deckId = useUrlParam(DECK_PAGE_PARAM, {parser: parseInt}); const deckId = useUrlParam(DECK_PAGE_PARAM, {parser: parseInt});
// todo поставить таумаут искуственно const [enabled, setEnabled] = useState(false);
const { data } = useDeck({ const { data } = useDeck({
deckId: deckId ?? 0, deckId: deckId ?? 0,
config: { config: {
enabled: !!deckId enabled: !!deckId && enabled
} }
}); });
@ -63,6 +64,11 @@ export const DeckPage: ReactFCC = () => {
); );
}, [data]); }, [data]);
useEffect(() => {
setTimeout(() => {
setEnabled(true)
}, 2000);
}, []);
return ( return (
<div className={s.DeckPage}> <div className={s.DeckPage}>

View File

@ -3,6 +3,7 @@ import {Image, Page, StyleSheet, Text, View} from '@react-pdf/renderer';
import {bgColor, pageFontStyles, primaryColor, subtitleStyles, titleStyles} from '../shared'; import {bgColor, pageFontStyles, primaryColor, subtitleStyles, titleStyles} from '../shared';
import {GetDeckResponse} from '../../../../api/deck/getDeck'; import {GetDeckResponse} from '../../../../api/deck/getDeck';
import {ExtractArray} from '../../../../utils/types'; import {ExtractArray} from '../../../../utils/types';
import {BACKEND_URL} from '../../../../config';
export interface Slide7Props { export interface Slide7Props {
data: ExtractArray<GetDeckResponse['slides']>['data']; data: ExtractArray<GetDeckResponse['slides']>['data'];
@ -35,12 +36,20 @@ const styles = StyleSheet.create({
subtitle: { subtitle: {
...subtitleStyles ...subtitleStyles
}, },
image: {
margin: '0 auto',
width: 400,
height: 400,
objectFit: 'contain'
}
}); });
export const Slide7: ReactFCC<Slide7Props> = (props) => { export const Slide7: ReactFCC<Slide7Props> = (props) => {
const { data } = props; const { data } = props;
const money = data.find((i) => i.slug === 'money')?.answer as string; 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 ( return (
<Page size="A4" orientation={'landscape'} style={styles.page}> <Page size="A4" orientation={'landscape'} style={styles.page}>
@ -49,6 +58,10 @@ export const Slide7: ReactFCC<Slide7Props> = (props) => {
<View style={styles.divider} /> <View style={styles.divider} />
<Text style={styles.text}>{money}</Text> <Text style={styles.text}>{money}</Text>
{url && (
<Image src={url} style={styles.image} />
)}
</View> </View>
</Page> </Page>
) )

View File

@ -1,6 +1,6 @@
import {ReactFCC} from '../../../../utils/ReactFCC'; import {ReactFCC} from '../../../../utils/ReactFCC';
import {Image, Page, StyleSheet, Text, View} from '@react-pdf/renderer'; 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 {GetDeckResponse} from '../../../../api/deck/getDeck';
import {ExtractArray} from '../../../../utils/types'; import {ExtractArray} from '../../../../utils/types';
import {BACKEND_URL} from '../../../../config'; import {BACKEND_URL} from '../../../../config';
@ -29,7 +29,6 @@ const styles = StyleSheet.create({
margin: '8px 0 16px' margin: '8px 0 16px'
}, },
text: { text: {
width: '100%',
fontSize: '16px', fontSize: '16px',
}, },
map: { map: {
@ -43,6 +42,7 @@ const styles = StyleSheet.create({
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
gap: 16, gap: 16,
width: 200,
}, },
image: { image: {
width: 200, width: 200,