|
1 | 1 | import { LoaderFill } from '@ouestware/loaders'; |
2 | 2 | import cx from 'classnames'; |
3 | 3 | import { ReactNode, useMemo, type FC } from 'react'; |
4 | | -import { RiAddCircleLine, RiFile3Line, RiPriceTag3Line } from 'react-icons/ri'; |
5 | | -import { useParams } from 'react-router-dom'; |
| 4 | +import { RiFile3Line, RiPriceTag3Line } from 'react-icons/ri'; |
| 5 | +import { Link, useParams } from 'react-router-dom'; |
6 | 6 |
|
7 | 7 | import { Collapsable } from '../components/Collapsable'; |
8 | 8 | import { InCartButton } from '../components/edition/InCartButton.tsx'; |
@@ -31,7 +31,7 @@ import { useItemCounts } from '../hooks/useItemCounts.ts'; |
31 | 31 | import { getMessageName } from '../utils/data.ts'; |
32 | 32 |
|
33 | 33 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
34 | | -type RelatedDefinition<T = any> = ListWithLoadMoreProps<T> & { title: ReactNode }; |
| 34 | +type RelatedDefinition<T = any> = ListWithLoadMoreProps<T> & { title: ReactNode; type: ItemType }; |
35 | 35 |
|
36 | 36 | export const ItemView: FC = () => { |
37 | 37 | const { enabled } = useEditionContext(); |
@@ -63,6 +63,7 @@ export const ItemView: FC = () => { |
63 | 63 |
|
64 | 64 | return [ |
65 | 65 | { |
| 66 | + type, |
66 | 67 | title: ( |
67 | 68 | <span className="fs-2"> |
68 | 69 | <ItemIcon type={type} /> {ITEM_TYPE_LABELS_PLURAL[type]} {total && `(${total})`} |
@@ -124,13 +125,19 @@ export const ItemView: FC = () => { |
124 | 125 |
|
125 | 126 | {relatedItems.map((related, index) => ( |
126 | 127 | <Collapsable key={index} title={related.title} className="mb-2" defaultOpen> |
127 | | - {editionEnabled && ( |
128 | | - <div className="mb-3"> |
| 128 | + <div className="mb-3 d-flex gap-1"> |
| 129 | + <Link |
| 130 | + to={`/explore/${related.type}?${inputType}|values=${id}#result`} |
| 131 | + className="btn btn-dark" |
| 132 | + > |
| 133 | + View in explore page |
| 134 | + </Link> |
| 135 | + {/* {editionEnabled && ( |
129 | 136 | <button className="btn btn-purple-300 with-icon"> |
130 | 137 | <RiAddCircleLine /> Add item |
131 | 138 | </button> |
132 | | - </div> |
133 | | - )} |
| 139 | + )} */} |
| 140 | + </div> |
134 | 141 | <ListWithLoadMore className="row" {...related} /> |
135 | 142 | </Collapsable> |
136 | 143 | ))} |
|
0 commit comments