Skip to content

Commit

Permalink
refactor: apply PR requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pyphilia committed Dec 11, 2024
1 parent 1e2cdca commit 70c12b2
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 85 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@emotion/react": "11.13.3",
"@emotion/server": "11.11.0",
"@emotion/styled": "11.13.0",
"@graasp/query-client": "github:graasp/graasp-query-client#tags",
"@graasp/query-client": "5.7.0",
"@graasp/sdk": "5.4.0",
"@graasp/stylis-plugin-rtl": "2.2.0",
"@graasp/translations": "1.43.0",
Expand Down
13 changes: 6 additions & 7 deletions src/components/filters/LangFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@ export function LangFilter({ title }: LangFilterProps) {
// received langs contain slugs, eg: fr
// transform from fr -> Français
const langOptions = options
? Object.keys(options).reduce(
(acc, key) => ({
? Object.keys(options).reduce((acc, key) => {
const k = key as `${keyof typeof langs}`;
return {
...acc,
// @ts-expect-error
...{ [langs[key] || key]: options[key] },
}),
{},
)
...{ [langs[k] || k]: options[k] },
};
}, {})
: {};

return (
Expand Down
49 changes: 0 additions & 49 deletions src/utils/helpers.js

This file was deleted.

35 changes: 35 additions & 0 deletions src/utils/helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { cloneElement } from 'react';

export const openInNewTab = (url: string) => {
const newWindow = window.open(url, '_blank', 'noopener,noreferrer');
if (newWindow) {
newWindow.opener = null;
}
};

/**
* Return an array with the separator interspersed between
* each element of the input array.
*
* > intersperse([1,2,3], 0)
* [1,0,2,0,3]
*/
export default function intersperse(
array: JSX.Element[],
separator: JSX.Element,
) {
return array
.filter((x) => x)
.reduce<JSX.Element[]>((output, item, index) => {
output.push(item);

if (index < array.length - 1) {
output.push(
// eslint-disable-next-line react/no-array-index-key
cloneElement(separator, { key: `interspersed-${index}` }),
);
}

return output;
}, []);
}
67 changes: 39 additions & 28 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1263,19 +1263,19 @@ __metadata:
languageName: node
linkType: hard

"@graasp/query-client@github:graasp/graasp-query-client#tags":
version: 5.6.1
resolution: "@graasp/query-client@https://github.com/graasp/graasp-query-client.git#commit=9b08c3cd13cf916088b9835eed2925b2e667116d"
"@graasp/query-client@npm:5.7.0":
version: 5.7.0
resolution: "@graasp/query-client@npm:5.7.0"
dependencies:
"@tanstack/react-query": "npm:5.61.0"
"@tanstack/react-query-devtools": "npm:5.61.0"
axios: "npm:1.7.7"
"@tanstack/react-query": "npm:5.61.5"
"@tanstack/react-query-devtools": "npm:5.61.5"
axios: "npm:1.7.8"
http-status-codes: "npm:2.3.0"
peerDependencies:
"@graasp/sdk": ^4.0.0 || ^5.0.0
"@graasp/translations": "*"
react: ^18.0.0
checksum: 10/8c048b6d5c2c94b5f9b12a77b1742580ca1e6719b31044f3d8a29d163e337c51c716de3bf0421f21b7869c683233c16b1c09f89e980a73ff5efc8f9ced64ea36
checksum: 10/c31a6395da6023332e03b8ee6d950fe7e106ca4e0ca9ce60cd4ecfd737ad12bcebe7ada735ed449120ede430f666f20cc6a026f6174399b0ad736273c8ba0cd0
languageName: node
linkType: hard

Expand Down Expand Up @@ -2777,40 +2777,40 @@ __metadata:
languageName: node
linkType: hard

"@tanstack/query-core@npm:5.60.6":
version: 5.60.6
resolution: "@tanstack/query-core@npm:5.60.6"
checksum: 10/a87613d85b3a280f2fef69037dd0ad512052d49b8dc979ed289ee538452d331926a720678bbd3b4485a8b38d5baf65c42869179f2fdeefa3f7b6dda04e878e56
"@tanstack/query-core@npm:5.61.5":
version: 5.61.5
resolution: "@tanstack/query-core@npm:5.61.5"
checksum: 10/e84a9dbd93cf5fa7abe7d4ba607e054cf15621194e1ec0145e05b826c0a27123947f0cc937cafe6254fb2289c0013b2283796f8c3844c0a19ed6082fb70a6632
languageName: node
linkType: hard

"@tanstack/query-devtools@npm:5.59.20":
version: 5.59.20
resolution: "@tanstack/query-devtools@npm:5.59.20"
checksum: 10/0bb2995337d78910c7677f780af42cd4285b39d618cd7876e24ec16243783d4cfe9e4d067d210d5337aefaad0a21928c5e4cb30fb4c08a09521625fcfe9c14d4
"@tanstack/query-devtools@npm:5.61.4":
version: 5.61.4
resolution: "@tanstack/query-devtools@npm:5.61.4"
checksum: 10/5267732b37781865c24241b9ffdd4d84d04d4e193f29fa9f0220967dcc738a3be25edcd45784fbeed340012200742a18bae25ce34f13190cc8dcb65bbee076ea
languageName: node
linkType: hard

"@tanstack/react-query-devtools@npm:5.61.0":
version: 5.61.0
resolution: "@tanstack/react-query-devtools@npm:5.61.0"
"@tanstack/react-query-devtools@npm:5.61.5":
version: 5.61.5
resolution: "@tanstack/react-query-devtools@npm:5.61.5"
dependencies:
"@tanstack/query-devtools": "npm:5.59.20"
"@tanstack/query-devtools": "npm:5.61.4"
peerDependencies:
"@tanstack/react-query": ^5.61.0
"@tanstack/react-query": ^5.61.5
react: ^18 || ^19
checksum: 10/ac4019ad58a04e21ef8fd2f5ab1e33791e3961979c25538b51a8597e9b2e448326f2d15e407bb89cb53a7f566f9bd15036dcd4573777c4bec428b79e8acdeb96
checksum: 10/1a6d34bd02a882aa98c6839e8d8b5859c498a82087f38b826956822c01054e76d690b89d5c36df102c1e62bc12f77c276856ed2dfc526f68f5684ad6d5d82a4e
languageName: node
linkType: hard

"@tanstack/react-query@npm:5.61.0":
version: 5.61.0
resolution: "@tanstack/react-query@npm:5.61.0"
"@tanstack/react-query@npm:5.61.5":
version: 5.61.5
resolution: "@tanstack/react-query@npm:5.61.5"
dependencies:
"@tanstack/query-core": "npm:5.60.6"
"@tanstack/query-core": "npm:5.61.5"
peerDependencies:
react: ^18 || ^19
checksum: 10/e98d1396cd157626f29fb0d0d10c75dbdde6e2efa55463540c9d8e33b58ec4b72eeb58b7d2eea6e625a8316235777f128222adeb10533ddfade77b23ec209872
checksum: 10/ae2108b03cc4b02c0dd08ddab44a157cdfa9949ccf5d4f4f7aa2d11ff345b3bc7a405138322ad99a538f476a77b2a188eb199119806df507cc988f09e8b34535
languageName: node
linkType: hard

Expand Down Expand Up @@ -3913,7 +3913,18 @@ __metadata:
languageName: node
linkType: hard

"axios@npm:1.7.7, axios@npm:^1.7.7":
"axios@npm:1.7.8":
version: 1.7.8
resolution: "axios@npm:1.7.8"
dependencies:
follow-redirects: "npm:^1.15.6"
form-data: "npm:^4.0.0"
proxy-from-env: "npm:^1.1.0"
checksum: 10/7ddcde188041ac55090186254b4025eb2af842be3cf615ce45393fd7f543c1eab0ad2fdd2017a5f6190695e3ecea73ee5e9c37f204854aec2698f9579046efdf
languageName: node
linkType: hard

"axios@npm:^1.7.7":
version: 1.7.7
resolution: "axios@npm:1.7.7"
dependencies:
Expand Down Expand Up @@ -7214,7 +7225,7 @@ __metadata:
"@emotion/react": "npm:11.13.3"
"@emotion/server": "npm:11.11.0"
"@emotion/styled": "npm:11.13.0"
"@graasp/query-client": "github:graasp/graasp-query-client#tags"
"@graasp/query-client": "npm:5.7.0"
"@graasp/sdk": "npm:5.4.0"
"@graasp/stylis-plugin-rtl": "npm:2.2.0"
"@graasp/translations": "npm:1.43.0"
Expand Down

0 comments on commit 70c12b2

Please sign in to comment.