mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
7ffb213ce7
- XSS fix: Created SanitizeHtml.ts utility using DOMPurify (already in package.json but never used). Wrapped all 21 dangerouslySetInnerHTML calls in catalog views with SanitizeHtml() — only allows safe tags (b, i, u, br, span, div, p, a, strong, em, img) - Race condition fix: Added 10-second timeout fallbacks on purchase flags in CatalogPurchaseWidgetView and CatalogGiftView so the flag auto-resets even if the server never responds
50 lines
2.4 KiB
TypeScript
50 lines
2.4 KiB
TypeScript
import { FC } from 'react';
|
|
import { SanitizeHtml } from '../../../../../api';
|
|
import { Column, Grid, Text } from '../../../../../common';
|
|
import { useCatalog } from '../../../../../hooks';
|
|
import { CatalogGuildBadgeWidgetView } from '../widgets/CatalogGuildBadgeWidgetView';
|
|
import { CatalogGuildSelectorWidgetView } from '../widgets/CatalogGuildSelectorWidgetView';
|
|
import { CatalogItemGridWidgetView } from '../widgets/CatalogItemGridWidgetView';
|
|
import { CatalogPurchaseWidgetView } from '../widgets/CatalogPurchaseWidgetView';
|
|
import { CatalogTotalPriceWidget } from '../widgets/CatalogTotalPriceWidget';
|
|
import { CatalogViewProductWidgetView } from '../widgets/CatalogViewProductWidgetView';
|
|
import { CatalogLayoutProps } from './CatalogLayout.types';
|
|
|
|
export const CatalogLayouGuildCustomFurniView: FC<CatalogLayoutProps> = props =>
|
|
{
|
|
const { page = null } = props;
|
|
const { currentOffer = null } = useCatalog();
|
|
|
|
return (
|
|
<Grid>
|
|
<Column overflow="hidden" size={ 7 }>
|
|
<CatalogItemGridWidgetView />
|
|
</Column>
|
|
<Column center={ !currentOffer } overflow="hidden" size={ 5 }>
|
|
{ !currentOffer &&
|
|
<>
|
|
{ !!page.localization.getImage(1) && <img alt="" src={ page.localization.getImage(1) } /> }
|
|
<Text center dangerouslySetInnerHTML={ { __html: SanitizeHtml(page.localization.getText(0)) } } />
|
|
</> }
|
|
{ currentOffer &&
|
|
<>
|
|
<div className="relative overflow-hidden">
|
|
<CatalogViewProductWidgetView />
|
|
<CatalogGuildBadgeWidgetView className="bottom-1 inset-e-1" position="absolute" />
|
|
</div>
|
|
<Column grow gap={ 1 }>
|
|
<Text truncate>{ currentOffer.localizationName }</Text>
|
|
<div className="grow!">
|
|
<CatalogGuildSelectorWidgetView />
|
|
</div>
|
|
<div className="flex justify-end">
|
|
<CatalogTotalPriceWidget alignItems="end" />
|
|
</div>
|
|
<CatalogPurchaseWidgetView />
|
|
</Column>
|
|
</> }
|
|
</Column>
|
|
</Grid>
|
|
);
|
|
};
|