Compare commits
7 Commits
f18d16a722
...
b6e4d3b22d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b6e4d3b22d | ||
0c05cf7661 | |||
f0e6ff9425 | |||
20bd7f5983 | |||
52902ff2ba | |||
c233cb60de | |||
![]() |
44ba54db95 |
@ -48,6 +48,16 @@ export default function AffinitiesFormDialog({ groups, group, visible, onHide }:
|
||||
});
|
||||
}
|
||||
|
||||
function resetAffinities() {
|
||||
fetch(`/api/${getSlug()}/groups/${group?.id}/affinities/default`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
}
|
||||
}).then((response) => response.json())
|
||||
.then(setAffinities);
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog header="Update affinities" visible={visible} style={{ width: '60vw' }} onHide={onHide}>
|
||||
{!isLoadingAffinities && <div className="card justify-evenly py-5 bg-gray-200 flex flex-col">
|
||||
@ -61,7 +71,10 @@ export default function AffinitiesFormDialog({ groups, group, visible, onHide }:
|
||||
</div>)
|
||||
}
|
||||
|
||||
<button className={classNames('primary')} onClick={submitAffinities} >Update</button>
|
||||
<div className="flex justify-center">
|
||||
<button className={classNames('gray')} onClick={resetAffinities} >Reset</button>
|
||||
<button className={classNames('primary')} onClick={submitAffinities} >Update</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</Dialog>
|
||||
|
@ -2,13 +2,14 @@
|
||||
|
||||
import clsx from "clsx";
|
||||
|
||||
type ButtonColor = 'primary' | 'blue' | 'green' | 'red' | 'yellow';
|
||||
type ButtonColor = 'primary' | 'blue' | 'green' | 'red' | 'yellow' | 'gray';
|
||||
|
||||
export function classNames(type: ButtonColor) {
|
||||
return (clsx("text-white py-1 px-2 mx-1 rounded disabled:opacity-50 disabled:cursor-not-allowed", {
|
||||
'bg-blue-400 hover:bg-blue-600': type === 'primary' || type === 'blue',
|
||||
'bg-green-500 hover:bg-green-600': type === 'green',
|
||||
'bg-red-500 hover:bg-red-600': type === 'red',
|
||||
'bg-yellow-500 hover:bg-yellow-700': type === 'yellow'
|
||||
'bg-yellow-500 hover:bg-yellow-700': type === 'yellow',
|
||||
'bg-gray-500 hover:bg-gray-700': type === 'gray'
|
||||
}))
|
||||
}
|
@ -35,6 +35,7 @@ export default function GroupsTable({ groups, onUpdate, onEdit, onEditAffinities
|
||||
return acc;
|
||||
}, new Map());
|
||||
|
||||
groups.forEach(group => group.children = []);
|
||||
groups.forEach(group => {
|
||||
if (group.parentId) {
|
||||
const parent = index.get(group.parentId);
|
||||
|
@ -29,7 +29,7 @@
|
||||
"@types/bcrypt": "^5.0.2",
|
||||
"@types/node": "22.10.5",
|
||||
"@types/react": "18.3.18",
|
||||
"@types/react-dom": "19.0.2"
|
||||
"@types/react-dom": "19.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=23.0.0"
|
||||
|
20
pnpm-lock.yaml
generated
20
pnpm-lock.yaml
generated
@ -13,7 +13,7 @@ importers:
|
||||
version: 2.2.0(react@19.0.0-rc-f38c22b244-20240704)
|
||||
'@tailwindcss/forms':
|
||||
specifier: ^0.5.7
|
||||
version: 0.5.9(tailwindcss@3.4.17)
|
||||
version: 0.5.10(tailwindcss@3.4.17)
|
||||
autoprefixer:
|
||||
specifier: 10.4.20
|
||||
version: 10.4.20(postcss@8.4.49)
|
||||
@ -73,8 +73,8 @@ importers:
|
||||
specifier: 18.3.18
|
||||
version: 18.3.18
|
||||
'@types/react-dom':
|
||||
specifier: 19.0.2
|
||||
version: 19.0.2(@types/react@18.3.18)
|
||||
specifier: 19.0.3
|
||||
version: 19.0.3(@types/react@18.3.18)
|
||||
|
||||
packages:
|
||||
|
||||
@ -320,10 +320,10 @@ packages:
|
||||
'@swc/helpers@0.5.15':
|
||||
resolution: {integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==}
|
||||
|
||||
'@tailwindcss/forms@0.5.9':
|
||||
resolution: {integrity: sha512-tM4XVr2+UVTxXJzey9Twx48c1gcxFStqn1pQz0tRsX8o3DvxhN5oY5pvyAbUx7VTaZxpej4Zzvc6h+1RJBzpIg==}
|
||||
'@tailwindcss/forms@0.5.10':
|
||||
resolution: {integrity: sha512-utI1ONF6uf/pPNO68kmN1b8rEwNXv3czukalo8VtJH8ksIkZXr3Q3VYudZLkCsDd4Wku120uF02hYK25XGPorw==}
|
||||
peerDependencies:
|
||||
tailwindcss: '>=3.0.0 || >= 3.0.0-alpha.1 || >= 4.0.0-alpha.20'
|
||||
tailwindcss: '>=3.0.0 || >= 3.0.0-alpha.1 || >= 4.0.0-alpha.20 || >= 4.0.0-beta.1'
|
||||
|
||||
'@types/bcrypt@5.0.2':
|
||||
resolution: {integrity: sha512-6atioO8Y75fNcbmj0G7UjI9lXN2pQ/IGJ2FWT4a/btd0Lk9lQalHLKhkgKVZ3r+spnmWUKfbMi1GEe9wyHQfNQ==}
|
||||
@ -337,8 +337,8 @@ packages:
|
||||
'@types/prop-types@15.7.12':
|
||||
resolution: {integrity: sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==}
|
||||
|
||||
'@types/react-dom@19.0.2':
|
||||
resolution: {integrity: sha512-c1s+7TKFaDRRxr1TxccIX2u7sfCnc3RxkVyBIUA2lCpyqCF+QoAwQ/CBg7bsMdVwP120HEH143VQezKtef5nCg==}
|
||||
'@types/react-dom@19.0.3':
|
||||
resolution: {integrity: sha512-0Knk+HJiMP/qOZgMyNFamlIjw9OFCsyC2ZbigmEEyXXixgre6IQpm/4V+r3qH4GC1JPvRJKInw+on2rV6YZLeA==}
|
||||
peerDependencies:
|
||||
'@types/react': ^19.0.0
|
||||
|
||||
@ -1358,7 +1358,7 @@ snapshots:
|
||||
dependencies:
|
||||
tslib: 2.8.1
|
||||
|
||||
'@tailwindcss/forms@0.5.9(tailwindcss@3.4.17)':
|
||||
'@tailwindcss/forms@0.5.10(tailwindcss@3.4.17)':
|
||||
dependencies:
|
||||
mini-svg-data-uri: 1.4.4
|
||||
tailwindcss: 3.4.17
|
||||
@ -1375,7 +1375,7 @@ snapshots:
|
||||
|
||||
'@types/prop-types@15.7.12': {}
|
||||
|
||||
'@types/react-dom@19.0.2(@types/react@18.3.18)':
|
||||
'@types/react-dom@19.0.3(@types/react@18.3.18)':
|
||||
dependencies:
|
||||
'@types/react': 18.3.18
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user