Skip to content

Commit

Permalink
fix: remove getCurrentAccountLang and use from sdk (#1525)
Browse files Browse the repository at this point in the history
  • Loading branch information
spaenleh authored Oct 18, 2024
1 parent a22b35e commit d5f3986
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 27 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@graasp/chatbox": "3.3.0",
"@graasp/map": "1.19.0",
"@graasp/query-client": "4.2.0",
"@graasp/sdk": "4.31.0",
"@graasp/sdk": "4.32.1",
"@graasp/stylis-plugin-rtl": "2.2.0",
"@graasp/translations": "1.39.0",
"@graasp/ui": "5.3.0",
Expand Down
9 changes: 5 additions & 4 deletions src/components/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ import { ToastContainer } from 'react-toastify';

import { CssBaseline } from '@mui/material';

import { langs } from '@graasp/translations';
import { getCurrentAccountLang } from '@graasp/sdk';
import { DEFAULT_LANG, langs } from '@graasp/translations';
import { ThemeProvider } from '@graasp/ui';

import * as Sentry from '@sentry/react';

import { getCurrentAccountLang } from '@/utils/member';

import i18nConfig from '../config/i18n';
import {
QueryClientProvider,
Expand All @@ -38,7 +37,9 @@ const ThemeWrapper = () => {
langs={langs}
languageSelectSx={{ mb: 2, mr: 2 }}
i18n={i18nConfig}
defaultDirection={i18nConfig.dir(getCurrentAccountLang(currentMember))}
defaultDirection={i18nConfig.dir(
getCurrentAccountLang(currentMember, DEFAULT_LANG),
)}
>
<CssBaseline />
<ToastContainer stacked position="bottom-left" theme="colored" />
Expand Down
13 changes: 1 addition & 12 deletions src/utils/member.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
import { AccountType, CurrentAccount, Member } from '@graasp/sdk';
import { DEFAULT_LANG } from '@graasp/translations';
import { Member } from '@graasp/sdk';

export const getMemberById = (
members: Member[],
id: string,
): Member | undefined => members.find(({ id: thisId }) => id === thisId);

export const getCurrentAccountLang = (
account: CurrentAccount | null | undefined,
// eslint-disable-next-line arrow-body-style
): string | undefined => {
if (account?.type === AccountType.Individual) {
return account.extra.lang;
}
return DEFAULT_LANG;
};
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1521,10 +1521,10 @@ __metadata:
languageName: node
linkType: hard

"@faker-js/faker@npm:9.0.1":
version: 9.0.1
resolution: "@faker-js/faker@npm:9.0.1"
checksum: 10/708629605392fdbe06887ca9b083d73801c64b47917f790870b240858ab65cada14b52dddf2cb7e471ad0f6ddf66ea30e7ffda741c5ba9bd5c27318b47262279
"@faker-js/faker@npm:9.0.3":
version: 9.0.3
resolution: "@faker-js/faker@npm:9.0.3"
checksum: 10/60ea71c31d6bd6317184736de17daee415e229cab5e10a4146a19622f3eb22f49f42345ff339dc9261f0214ca1f9b019c63fd9aac842a2d359f135102788ec90
languageName: node
linkType: hard

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

"@graasp/sdk@npm:4.31.0":
version: 4.31.0
resolution: "@graasp/sdk@npm:4.31.0"
"@graasp/sdk@npm:4.32.1":
version: 4.32.1
resolution: "@graasp/sdk@npm:4.32.1"
dependencies:
"@faker-js/faker": "npm:9.0.1"
"@faker-js/faker": "npm:9.0.3"
filesize: "npm:10.1.6"
js-cookie: "npm:3.0.5"
validator: "npm:13.12.0"
peerDependencies:
date-fns: ^3 || ^4.0.0
uuid: ^9 || ^10
checksum: 10/9b2bf85a51cc12b6f2bdefeb7bbc0c615db9ea3188ace6d460b14e61503763aeab13fd2aa1c4135cee602c2c58465895569b2845b91d942982f96f5594dfd1d4
checksum: 10/74125fa4c2aed104142cccc77e8a8a90d2ae303dcaae83e40198f7d30d6615ad3136532789b0d1c2f7034847937f238c046b9aee5fcee5d319bbe7be8cb4f257
languageName: node
linkType: hard

Expand Down Expand Up @@ -6473,7 +6473,7 @@ __metadata:
"@graasp/chatbox": "npm:3.3.0"
"@graasp/map": "npm:1.19.0"
"@graasp/query-client": "npm:4.2.0"
"@graasp/sdk": "npm:4.31.0"
"@graasp/sdk": "npm:4.32.1"
"@graasp/stylis-plugin-rtl": "npm:2.2.0"
"@graasp/translations": "npm:1.39.0"
"@graasp/ui": "npm:5.3.0"
Expand Down

0 comments on commit d5f3986

Please sign in to comment.