fix(category): open in new tab, require game select

This commit is contained in:
enes 2024-12-05 13:37:30 +01:00
parent 8d9bbbc7a5
commit 41cfc57cf9
2 changed files with 45 additions and 48 deletions

View File

@ -1100,44 +1100,33 @@ export const CategoryAutocomplete = ({
{Row}
</VariableSizeList>
) : (
<FixedSizeList
height={500}
width={'100%'}
itemCount={1}
itemSize={35}
<div
className='dropdown-item dropdownMainMenuItem'
onClick={handleAddNew}
>
{({ index, style }) => (
<div
style={style}
className='dropdown-item dropdownMainMenuItem'
onClick={handleAddNew}
>
{inputValue &&
!filteredOptions?.find(
(option) =>
option.hierarchy.toLowerCase() ===
inputValue.toLowerCase()
) ? (
<>
Add "{inputValue}"
<button className='btn btnMain btnMainInsideField btnMainRemove'>
<svg
xmlns='http://www.w3.org/2000/svg'
viewBox='-32 0 512 512'
width='1em'
height='1em'
fill='currentColor'
>
<path d='M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z'></path>
</svg>
</button>
</>
) : (
<>No matches</>
)}
</div>
{inputValue &&
!filteredOptions?.find(
(option) =>
option.hierarchy.toLowerCase() === inputValue.toLowerCase()
) ? (
<>
Add "{inputValue}"
<button className='btn btnMain btnMainInsideField btnMainRemove'>
<svg
xmlns='http://www.w3.org/2000/svg'
viewBox='-32 0 512 512'
width='1em'
height='1em'
fill='currentColor'
>
<path d='M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z'></path>
</svg>
</button>
</>
) : (
<>No matches</>
)}
</FixedSizeList>
</div>
)}
</div>
</div>
@ -1147,18 +1136,25 @@ export const CategoryAutocomplete = ({
{LTags.map((hierarchy) => {
const heirarchicalCategories = hierarchy.split(`:`)
const categories = heirarchicalCategories
.map<React.ReactNode>((c, i) => (
<Link
key={`category-${i}`}
to={{
pathname: getGamePageRoute(game),
search: `l=${c}`
}}
className='IBMSMSMBSSCategoriesBoxItem'
>
<p>{capitalizeEachWord(c)}</p>
</Link>
))
.map<React.ReactNode>((c, i) =>
game ? (
<Link
key={`category-${i}`}
target='_blank'
to={{
pathname: getGamePageRoute(game),
search: `l=${c}`
}}
className='IBMSMSMBSSCategoriesBoxItem'
>
<p>{capitalizeEachWord(c)}</p>
</Link>
) : (
<p className='IBMSMSMBSSCategoriesBoxItem'>
{capitalizeEachWord(c)}
</p>
)
)
.reduce((prev, curr, i) => [
prev,
<div

View File

@ -548,6 +548,7 @@ const Body = ({
.map<React.ReactNode>((c: string) => (
<ReactRouterLink
className='IBMSMSMBSSCategoriesBoxItem'
target='_blank'
to={{
pathname: getGamePageRoute(game),
search: `l=${c}`