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

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_ROUTE = `/deck/:${DECK_PAGE_PARAM}`;

View File

@ -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 (
<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 {GetDeckResponse} from '../../../../api/deck/getDeck';
import {ExtractArray} from '../../../../utils/types';
import {BACKEND_URL} from '../../../../config';
export interface Slide7Props {
data: ExtractArray<GetDeckResponse['slides']>['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<Slide7Props> = (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 (
<Page size="A4" orientation={'landscape'} style={styles.page}>
@ -49,6 +58,10 @@ export const Slide7: ReactFCC<Slide7Props> = (props) => {
<View style={styles.divider} />
<Text style={styles.text}>{money}</Text>
{url && (
<Image src={url} style={styles.image} />
)}
</View>
</Page>
)

View File

@ -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,