This commit is contained in:
Anton Tranelis 2025-12-16 21:34:36 +01:00
parent c962bee38e
commit 278f5ed456
7 changed files with 53 additions and 130 deletions

View File

@ -101,15 +101,10 @@ export const Autocomplete = ({
ref={inputRef}
{...inputProps}
type='text'
<<<<<<< refactor-tab-layout
onChange={(e) => handleChange(e)}
tabIndex={-1}
=======
onChange={(e) => {
handleChange(e)
}}
tabIndex='-1'
>>>>>>> main
tabIndex={-1}
onKeyDown={handleKeyDown}
className='tw:border-none tw:focus:outline-none tw:focus:ring-0 tw:mt-5 tw:w-full'
/>
@ -118,12 +113,13 @@ export const Autocomplete = ({
>
{filteredSuggestions.map((suggestion, index) => (
<li
<<<<<<< refactor-tab-layout
key={suggestion.id}
role='option'
tabIndex={0}
aria-selected={index === highlightedSuggestion}
onClick={() => handleSuggestionClick(suggestion)}
onClick={() => {
handleSuggestionClick(suggestion)
}}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault()
@ -132,14 +128,6 @@ export const Autocomplete = ({
}}
>
<TagView heighlight={index === highlightedSuggestion} tag={suggestion}></TagView>
=======
key={index}
onClick={() => {
handleSuggestionClick(suggestion)
}}
>
<TagView heighlight={index === heighlightedSuggestion} tag={suggestion}></TagView>
>>>>>>> main
</li>
))}
</ul>

View File

@ -24,13 +24,13 @@ export const ProfileTagsForm = ({ state, setState, dataField, heading, placehold
<TagsWidget
// eslint-disable-next-line security/detect-object-injection
defaultTags={state[dataField]}
onUpdate={(tags) =>
onUpdate={(tags) => {
setState((prevState) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const updated = { ...prevState, [dataField]: tags }
return updated
})
}
}}
placeholder={placeholder ?? defaultPlaceholder}
containerStyle='tw:bg-transparent tw:w-full tw:flex-1 tw:text-xs tw:pb-2 tw:overflow-auto'
/>

View File

@ -25,7 +25,9 @@ const componentMap: ComponentMap = {
gallery: GalleryForm,
inviteLinks: () => null,
relations: () => null, // Relations are not editable in form
// eslint-disable-next-line camelcase -- Keys match external data schema
tags_component: ProfileTagsForm,
// eslint-disable-next-line camelcase -- Keys match external data schema
attestations_component: () => null, // Attestations are view-only
}
@ -69,7 +71,7 @@ export const TabsContainerForm = ({ item, state, setState, tabs, iconAsLabels =
(index: number) => {
setActiveTab(index)
const params = new URLSearchParams(location.search)
params.set('tab', `${index}`)
params.set('tab', String(index))
const newUrl = location.pathname + '?' + params.toString()
navigate(newUrl)
},
@ -89,7 +91,9 @@ export const TabsContainerForm = ({ item, state, setState, tabs, iconAsLabels =
type='button'
key={tab.id}
className={`tw:flex-1 tw:flex tw:items-center tw:justify-center tw:gap-2 tw:py-2 tw:px-4 tw:rounded-md tw:transition-colors tw:cursor-pointer ${activeTab === index ? 'tw:bg-primary tw:text-primary-content' : 'hover:tw:bg-base-300'}`}
onClick={() => updateActiveTab(index)}
onClick={() => {
updateActiveTab(index)
}}
onKeyDown={(e) => {
if (e.key === 'Enter') {
e.preventDefault()

View File

@ -27,7 +27,9 @@ const componentMap: ComponentMap = {
crowdfundings: CrowdfundingView,
inviteLinks: InviteLinkView,
relations: RelationsView,
// eslint-disable-next-line camelcase -- Keys match external data schema
tags_component: ProfileTagsView,
// eslint-disable-next-line camelcase -- Keys match external data schema
attestations_component: AttestationsView,
}
@ -69,7 +71,7 @@ export const TabsContainerView = ({ item, tabs = [], iconAsLabels = false }: Pro
(index: number) => {
setActiveTab(index)
const params = new URLSearchParams(location.search)
params.set('tab', `${index}`)
params.set('tab', String(index))
const newUrl = location.pathname + '?' + params.toString()
navigate(newUrl)
},
@ -88,7 +90,9 @@ export const TabsContainerView = ({ item, tabs = [], iconAsLabels = false }: Pro
<button
key={tab.id}
className={`tw:flex-1 tw:flex tw:items-center tw:justify-center tw:gap-2 tw:py-2 tw:px-4 tw:rounded-md tw:transition-colors tw:cursor-pointer ${activeTab === index ? 'tw:bg-primary tw:text-primary-content' : 'hover:tw:bg-base-300'}`}
onClick={() => updateActiveTab(index)}
onClick={() => {
updateActiveTab(index)
}}
>
{tab.icon && <span>{tab.icon}</span>}
{!(iconAsLabels && activeTab !== index) && <span>{tab.title}</span>}

View File

@ -21,7 +21,9 @@ const componentMap = {
gallery: GalleryForm,
inviteLinks: () => null,
relations: () => null,
// eslint-disable-next-line camelcase -- Keys match external data schema
tags_component: ProfileTagsForm,
// eslint-disable-next-line camelcase -- Keys match external data schema
attestations_component: () => null,
tabs: TabsContainerForm,
}

View File

@ -24,7 +24,9 @@ const componentMap = {
crowdfundings: CrowdfundingView,
inviteLinks: InviteLinkView,
relations: RelationsView,
// eslint-disable-next-line camelcase -- Keys match external data schema
tags_component: ProfileTagsView,
// eslint-disable-next-line camelcase -- Keys match external data schema
attestations_component: AttestationsView,
tabs: TabsContainerView,
}

139
package-lock.json generated
View File

@ -3398,29 +3398,6 @@
"node": "20 || >=22"
}
},
"node_modules/@isaacs/balanced-match": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz",
"integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": "20 || >=22"
}
},
"node_modules/@isaacs/brace-expansion": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz",
"integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@isaacs/balanced-match": "^4.0.1"
},
"engines": {
"node": "20 || >=22"
}
},
"node_modules/@isaacs/cliui": {
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
@ -5760,6 +5737,30 @@
"@types/node": "*"
}
},
"node_modules/@typescript-eslint/parser": {
"version": "5.62.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz",
"integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==",
"dev": true,
"license": "BSD-2-Clause",
"peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "5.62.0",
"@typescript-eslint/types": "5.62.0",
"@typescript-eslint/typescript-estree": "5.62.0",
"debug": "^4.3.4"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"typescript": ">=4.8.4 <6.0.0"
}
},
"node_modules/@typescript-eslint/project-service": {
"version": "8.48.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.48.1.tgz",
@ -5795,43 +5796,6 @@
}
}
},
"node_modules/@typescript-eslint/parser": {
"version": "5.62.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz",
"integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==",
"dev": true,
"license": "BSD-2-Clause",
"dependencies": {
"@typescript-eslint/scope-manager": "5.62.0",
"@typescript-eslint/types": "5.62.0",
"@typescript-eslint/typescript-estree": "5.62.0",
"debug": "^4.3.4"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"typescript": ">=4.8.4 <6.0.0"
}
},
"node_modules/@typescript-eslint/project-service/node_modules/@typescript-eslint/types": {
"version": "8.48.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.48.1.tgz",
"integrity": "sha512-+fZ3LZNeiELGmimrujsDCT4CRIbq5oXdHe7chLiW8qzqyPMnn1puNstCrMNVAqwcl2FdIxkuJ4tOs/RFDBVc/Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/tsconfig-utils": {
"version": "8.48.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.48.1.tgz",
@ -8675,11 +8639,8 @@
"integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==",
"dev": true,
"license": "MIT",
<<<<<<< refactor-tab-layout
=======
"optional": true,
"peer": true,
>>>>>>> main
"dependencies": {
"@rtsao/scc": "^1.1.0",
"array-includes": "^3.1.9",
@ -8761,49 +8722,6 @@
"node": ">=12.0"
}
},
<<<<<<< refactor-tab-layout
"node_modules/eslint-plugin-n": {
"version": "17.23.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-17.23.1.tgz",
"integrity": "sha512-68PealUpYoHOBh332JLLD9Sj7OQUDkFpmcfqt8R9sySfFSeuGJjMTJQvCRRB96zO3A/PELRLkPrzsHmzEFQQ5A==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/eslint-utils": "^4.5.0",
"enhanced-resolve": "^5.17.1",
"eslint-plugin-es-x": "^7.8.0",
"get-tsconfig": "^4.8.1",
"globals": "^15.11.0",
"globrex": "^0.1.2",
"ignore": "^5.3.2",
"semver": "^7.6.3",
"ts-declaration-location": "^1.0.6"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"url": "https://opencollective.com/eslint"
},
"peerDependencies": {
"eslint": ">=8.23.0"
}
},
"node_modules/eslint-plugin-n/node_modules/globals": {
"version": "15.15.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz",
"integrity": "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
=======
>>>>>>> main
"node_modules/eslint-plugin-no-catch-all": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-no-catch-all/-/eslint-plugin-no-catch-all-1.1.0.tgz",
@ -9515,7 +9433,8 @@
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"dev": true,
"license": "ISC"
"license": "ISC",
"peer": true
},
"node_modules/fsevents": {
"version": "2.3.3",
@ -9721,6 +9640,7 @@
"deprecated": "Glob versions prior to v9 are no longer supported",
"dev": true,
"license": "ISC",
"peer": true,
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
@ -10210,6 +10130,7 @@
"deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.",
"dev": true,
"license": "ISC",
"peer": true,
"dependencies": {
"once": "^1.3.0",
"wrappy": "1"
@ -10220,7 +10141,8 @@
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true,
"license": "ISC"
"license": "ISC",
"peer": true
},
"node_modules/ini": {
"version": "2.0.0",
@ -13027,6 +12949,7 @@
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=0.10.0"
}