@os-team/profile 1.0.36 → 1.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/profile/ProfileDrawer.js +19 -232
- package/dist/cjs/components/profile/ProfileDrawer.js.map +1 -1
- package/dist/cjs/components/profile/ProfileDrawerContent.js +259 -0
- package/dist/cjs/components/profile/ProfileDrawerContent.js.map +1 -0
- package/dist/cjs/components/profile/ProfileUpdateNameForm.js.map +1 -1
- package/dist/cjs/components/profile/ProfileUpdatePasswordForm.js.map +1 -1
- package/dist/cjs/components/profile/ProtectedWrapper.js.map +1 -1
- package/dist/cjs/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.js +70 -0
- package/dist/cjs/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.js.map +1 -0
- package/dist/cjs/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.js +89 -0
- package/dist/cjs/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.js.map +1 -0
- package/dist/cjs/components/session/SessionDrawer.js +17 -10
- package/dist/cjs/components/session/SessionDrawer.js.map +1 -1
- package/dist/cjs/components/session/SessionDrawerContent.js +1 -4
- package/dist/cjs/components/session/SessionDrawerContent.js.map +1 -1
- package/dist/esm/components/profile/ProfileDrawer.js +12 -196
- package/dist/esm/components/profile/ProfileDrawer.js.map +1 -1
- package/dist/esm/components/profile/ProfileDrawerContent.js +201 -0
- package/dist/esm/components/profile/ProfileDrawerContent.js.map +1 -0
- package/dist/esm/components/profile/ProfileUpdateNameForm.js.map +1 -1
- package/dist/esm/components/profile/ProfileUpdatePasswordForm.js.map +1 -1
- package/dist/esm/components/profile/ProtectedWrapper.js.map +1 -1
- package/dist/esm/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.js +62 -0
- package/dist/esm/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.js.map +1 -0
- package/dist/esm/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.js +81 -0
- package/dist/esm/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.js.map +1 -0
- package/dist/esm/components/session/SessionDrawer.js +7 -4
- package/dist/esm/components/session/SessionDrawer.js.map +1 -1
- package/dist/esm/components/session/SessionDrawerContent.js +0 -1
- package/dist/esm/components/session/SessionDrawerContent.js.map +1 -1
- package/dist/types/components/profile/ProfileDrawer.d.ts +2 -3
- package/dist/types/components/profile/ProfileDrawer.d.ts.map +1 -1
- package/dist/types/components/profile/ProfileDrawerContent.d.ts +8 -0
- package/dist/types/components/profile/ProfileDrawerContent.d.ts.map +1 -0
- package/dist/types/components/profile/ProfileUpdateNameForm.d.ts +4 -1
- package/dist/types/components/profile/ProfileUpdateNameForm.d.ts.map +1 -1
- package/dist/types/components/profile/ProfileUpdatePasswordForm.d.ts +4 -1
- package/dist/types/components/profile/ProfileUpdatePasswordForm.d.ts.map +1 -1
- package/dist/types/components/profile/ProtectedWrapper.d.ts +1 -0
- package/dist/types/components/profile/ProtectedWrapper.d.ts.map +1 -1
- package/dist/types/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.d.ts +14 -0
- package/dist/types/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.d.ts.map +1 -0
- package/dist/types/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.d.ts +20 -0
- package/dist/types/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.d.ts.map +1 -0
- package/dist/types/components/session/SessionDrawer.d.ts.map +1 -1
- package/dist/types/components/session/SessionDrawerContent.d.ts +0 -1
- package/dist/types/components/session/SessionDrawerContent.d.ts.map +1 -1
- package/package.json +47 -47
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileUpdateNameForm.tsx"],"names":["ProfileUpdateNameForm","children","t","formError","firstName","lastName"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileUpdateNameForm.tsx"],"names":["ProfileUpdateNameForm","children","t","formError","firstName","lastName"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAWA,IAAMA,qBAA2D,GAAG,SAA9DA,qBAA8D,OAE9D;AAAA,MADJC,QACI,QADJA,QACI;;AACJ,wBAAc,kCAAe,SAAf,CAAd;AAAA,MAAQC,CAAR,mBAAQA,CAAR;;AACA,iBAAsB,yBAAtB;AAAA,MAAQC,SAAR,YAAQA,SAAR;;AAEA,MAAMC,SAAS,GAAG,4BAAY,WAAZ,CAAlB;AACA,MAAMC,QAAQ,GAAG,4BAAY,UAAZ,CAAjB;AAEA,sBACE,6BAAC,UAAD,qBACE,6BAAC,cAAD;AACE,IAAA,KAAK,EAAEH,CAAC,CAAC,yCAAD;AADV,KAEME,SAAS,CAAC,CAAD,CAFf,gBAIE,6BAAC,WAAD;AACE,IAAA,WAAW,EAAEF,CAAC,CAAC,+CAAD;AADhB,KAEME,SAAS,CAAC,CAAD,CAFf,EAJF,CADF,eAWE,6BAAC,cAAD;AACE,IAAA,KAAK,EAAEF,CAAC,CAAC,wCAAD;AADV,KAEMG,QAAQ,CAAC,CAAD,CAFd,gBAIE,6BAAC,WAAD;AACE,IAAA,WAAW,EAAEH,CAAC,CAAC,8CAAD;AADhB,KAEMG,QAAQ,CAAC,CAAD,CAFd,EAJF,CAXF,EAqBGF,SAAS,iBAAI,6BAAC,WAAD;AAAO,IAAA,IAAI,EAAC;AAAZ,KAAqBA,SAArB,CArBhB,EAuBGF,QAvBH,CADF;AA2BD,CApCD;;eAsCeD,qB","sourcesContent":["import React from 'react';\nimport { useForm, useFormItem } from '@os-team/form-utils';\nimport { Alert, Form, FormItem, Input } from '@os-design/core';\nimport { useTranslation } from 'react-i18next';\n\nexport interface ProfileUpdateNameFormData {\n firstName: string;\n lastName: string;\n}\n\ninterface ProfileUpdateNameFormProps {\n children?: React.ReactNode;\n}\n\nconst ProfileUpdateNameForm: React.FC<ProfileUpdateNameFormProps> = ({\n children,\n}) => {\n const { t } = useTranslation('profile');\n const { formError } = useForm();\n\n const firstName = useFormItem('firstName');\n const lastName = useFormItem('lastName');\n\n return (\n <Form>\n <FormItem\n label={t('profile:updateNameModal.firstName.label')}\n {...firstName[0]}\n >\n <Input\n placeholder={t('profile:updateNameModal.firstName.placeholder')}\n {...firstName[1]}\n />\n </FormItem>\n\n <FormItem\n label={t('profile:updateNameModal.lastName.label')}\n {...lastName[0]}\n >\n <Input\n placeholder={t('profile:updateNameModal.lastName.placeholder')}\n {...lastName[1]}\n />\n </FormItem>\n\n {formError && <Alert type='error'>{formError}</Alert>}\n\n {children}\n </Form>\n );\n};\n\nexport default ProfileUpdateNameForm;\n"],"file":"ProfileUpdateNameForm.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileUpdatePasswordForm.tsx"],"names":["ProfileUpdatePasswordForm","children","t","formError","currentPassword","password","returnObjects"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileUpdatePasswordForm.tsx"],"names":["ProfileUpdatePasswordForm","children","t","formError","currentPassword","password","returnObjects"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAWA,IAAMA,yBAAmE,GAAG,SAAtEA,yBAAsE,OAEtE;AAAA,MADJC,QACI,QADJA,QACI;;AACJ,wBAAc,kCAAe,SAAf,CAAd;AAAA,MAAQC,CAAR,mBAAQA,CAAR;;AACA,iBAAsB,yBAAtB;AAAA,MAAQC,SAAR,YAAQA,SAAR;;AAEA,MAAMC,eAAe,GAAG,4BAAY,iBAAZ,CAAxB;AACA,MAAMC,QAAQ,GAAG,4BAAY,UAAZ,CAAjB;AAEA,sBACE,6BAAC,UAAD,qBACE,6BAAC,cAAD;AACE,IAAA,KAAK,EAAEH,CAAC,CAAC,mDAAD;AADV,KAEME,eAAe,CAAC,CAAD,CAFrB,gBAIE,6BAAC,mBAAD;AACE,IAAA,WAAW,EAAEF,CAAC,CACZ,yDADY;AADhB,KAIME,eAAe,CAAC,CAAD,CAJrB,EAJF,CADF,eAaE,6BAAC,cAAD;AACE,IAAA,KAAK,EAAEF,CAAC,CAAC,+CAAD;AADV,KAEMG,QAAQ,CAAC,CAAD,CAFd,gBAIE,6BAAC,mBAAD;AACE,IAAA,WAAW,EAAEH,CAAC,CAAC,qDAAD,CADhB;AAEE,IAAA,iBAAiB,MAFnB;AAGE,IAAA,aAAa,EAAEA,CAAC,CACd,mDADc,EAEd;AACEI,MAAAA,aAAa,EAAE;AADjB,KAFc;AAHlB,KASMD,QAAQ,CAAC,CAAD,CATd,EAJF,CAbF,EA8BGF,SAAS,iBAAI,6BAAC,WAAD;AAAO,IAAA,IAAI,EAAC;AAAZ,KAAqBA,SAArB,CA9BhB,EAgCGF,QAhCH,CADF;AAoCD,CA7CD;;eA+CeD,yB","sourcesContent":["import React from 'react';\nimport { useForm, useFormItem } from '@os-team/form-utils';\nimport { Alert, Form, FormItem, InputPassword } from '@os-design/core';\nimport { useTranslation } from 'react-i18next';\n\nexport interface ProfileUpdatePasswordFormData {\n currentPassword: string;\n password: string;\n}\n\ninterface ProfileUpdatePasswordFormProps {\n children?: React.ReactNode;\n}\n\nconst ProfileUpdatePasswordForm: React.FC<ProfileUpdatePasswordFormProps> = ({\n children,\n}) => {\n const { t } = useTranslation('profile');\n const { formError } = useForm();\n\n const currentPassword = useFormItem('currentPassword');\n const password = useFormItem('password');\n\n return (\n <Form>\n <FormItem\n label={t('profile:updatePasswordModal.currentPassword.label')}\n {...currentPassword[0]}\n >\n <InputPassword\n placeholder={t(\n 'profile:updatePasswordModal.currentPassword.placeholder'\n )}\n {...currentPassword[1]}\n />\n </FormItem>\n\n <FormItem\n label={t('profile:updatePasswordModal.newPassword.label')}\n {...password[0]}\n >\n <InputPassword\n placeholder={t('profile:updatePasswordModal.newPassword.placeholder')}\n showStrengthMeter\n strengthNames={t(\n 'profile:updatePasswordModal.passwordStrengthNames',\n {\n returnObjects: true,\n }\n )}\n {...password[1]}\n />\n </FormItem>\n\n {formError && <Alert type='error'>{formError}</Alert>}\n\n {children}\n </Form>\n );\n};\n\nexport default ProfileUpdatePasswordForm;\n"],"file":"ProfileUpdatePasswordForm.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/profile/ProtectedWrapper.tsx"],"names":["ProtectedWrapperLoader","children","fetchPolicy","profile","profileContext","id","email","firstName","undefined","lastName","avatar","ProtectedWrapper","bucketId","profileConfigContext","window","location","href"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/components/profile/ProtectedWrapper.tsx"],"names":["ProtectedWrapperLoader","children","fetchPolicy","profile","profileContext","id","email","firstName","undefined","lastName","avatar","ProtectedWrapper","bucketId","profileConfigContext","window","location","href"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;AAOA,IAAMA,sBAA6D,GAAG,SAAhEA,sBAAgE,OAEhE;AAAA,MADJC,QACI,QADJA,QACI;;AACJ,0BAAoB,kdAYlB,EAZkB,EAalB;AAAEC,IAAAA,WAAW,EAAE;AAAf,GAbkB,CAApB;AAAA,MAAQC,OAAR,qBAAQA,OAAR;;AAgBA,MAAMC,cAAc,GAAG,oBACrB;AAAA,WAAO;AACLC,MAAAA,EAAE,EAAEF,OAAO,CAACE,EADP;AAELC,MAAAA,KAAK,EAAEH,OAAO,CAACG,KAFV;AAGLC,MAAAA,SAAS,EAAEJ,OAAO,CAACI,SAAR,IAAqBC,SAH3B;AAILC,MAAAA,QAAQ,EAAEN,OAAO,CAACM,QAAR,IAAoBD,SAJzB;AAKLE,MAAAA,MAAM,EAAEP,OAAO,CAACO,MAAR,IAAkBF;AALrB,KAAP;AAAA,GADqB,EAQrB,CACEL,OAAO,CAACO,MADV,EAEEP,OAAO,CAACG,KAFV,EAGEH,OAAO,CAACI,SAHV,EAIEJ,OAAO,CAACE,EAJV,EAKEF,OAAO,CAACM,QALV,CARqB,CAAvB;AAiBA,sBACE,6BAAC,uBAAD,CAAgB,QAAhB;AAAyB,IAAA,KAAK,EAAEL;AAAhC,KACGH,QADH,CADF;AAKD,CAzCD;;AAgDA,IAAMU,gBAAiD,GAAG,SAApDA,gBAAoD,QAGpD;AAAA,MAFJC,QAEI,SAFJA,QAEI;AAAA,MADJX,QACI,SADJA,QACI;AACJ,MAAMY,oBAAoB,GAAG,oBAAQ;AAAA,WAAO;AAAED,MAAAA,QAAQ,EAARA;AAAF,KAAP;AAAA,GAAR,EAA8B,CAACA,QAAD,CAA9B,CAA7B;AAEA,sBACE,6BAAC,6BAAD,CAAsB,QAAtB;AAA+B,IAAA,KAAK,EAAEC;AAAtC,kBACE,6BAAC,oBAAD;AACE,IAAA,QAAQ,EAAE,oBAAM;AACdC,MAAAA,MAAM,CAACC,QAAP,CAAgBC,IAAhB,GAAuB,QAAvB;AACA,aAAO,IAAP;AACD;AAJH,kBAME,6BAAC,sBAAD,QAAyBf,QAAzB,CANF,CADF,CADF;AAYD,CAlBD;;eAoBeU,gB","sourcesContent":["import React, { useMemo } from 'react';\nimport graphql from 'babel-plugin-relay/macro';\nimport { useLazyLoadQuery } from 'react-relay/hooks';\nimport { ErrorBoundary } from '@os-design/utils';\nimport ProfileConfigContext from './ProfileConfigContext';\nimport ProfileContext from './ProfileContext';\nimport { ProtectedWrapperQuery } from './__generated__/ProtectedWrapperQuery.graphql';\n\ninterface ProtectedWrapperLoaderProps {\n children?: React.ReactNode;\n}\n\nconst ProtectedWrapperLoader: React.FC<ProtectedWrapperLoaderProps> = ({\n children,\n}) => {\n const { profile } = useLazyLoadQuery<ProtectedWrapperQuery>(\n graphql`\n query ProtectedWrapperQuery {\n profile {\n id\n email\n firstName\n lastName\n avatar\n }\n }\n `,\n {},\n { fetchPolicy: 'store-or-network' }\n );\n\n const profileContext = useMemo(\n () => ({\n id: profile.id,\n email: profile.email,\n firstName: profile.firstName || undefined,\n lastName: profile.lastName || undefined,\n avatar: profile.avatar || undefined,\n }),\n [\n profile.avatar,\n profile.email,\n profile.firstName,\n profile.id,\n profile.lastName,\n ]\n );\n\n return (\n <ProfileContext.Provider value={profileContext}>\n {children}\n </ProfileContext.Provider>\n );\n};\n\nexport interface ProtectedWrapperProps {\n bucketId: string;\n children?: React.ReactNode;\n}\n\nconst ProtectedWrapper: React.FC<ProtectedWrapperProps> = ({\n bucketId,\n children,\n}) => {\n const profileConfigContext = useMemo(() => ({ bucketId }), [bucketId]);\n\n return (\n <ProfileConfigContext.Provider value={profileConfigContext}>\n <ErrorBoundary\n fallback={() => {\n window.location.href = '/auth/';\n return null;\n }}\n >\n <ProtectedWrapperLoader>{children}</ProtectedWrapperLoader>\n </ErrorBoundary>\n </ProfileConfigContext.Provider>\n );\n};\n\nexport default ProtectedWrapper;\n"],"file":"ProtectedWrapper.js"}
|
package/dist/cjs/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @generated SignedSource<<832737ac96fa474b0ed0902ff8d86b14>>
|
|
10
|
+
* @lightSyntaxTransform
|
|
11
|
+
* @nogrep
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/* tslint:disable */
|
|
15
|
+
|
|
16
|
+
/* eslint-disable */
|
|
17
|
+
// @ts-nocheck
|
|
18
|
+
var node = function () {
|
|
19
|
+
var v0 = [{
|
|
20
|
+
"alias": null,
|
|
21
|
+
"args": null,
|
|
22
|
+
"concreteType": "StatusPayload",
|
|
23
|
+
"kind": "LinkedField",
|
|
24
|
+
"name": "signOut",
|
|
25
|
+
"plural": false,
|
|
26
|
+
"selections": [{
|
|
27
|
+
"alias": null,
|
|
28
|
+
"args": null,
|
|
29
|
+
"kind": "ScalarField",
|
|
30
|
+
"name": "ok",
|
|
31
|
+
"storageKey": null
|
|
32
|
+
}],
|
|
33
|
+
"storageKey": null
|
|
34
|
+
}];
|
|
35
|
+
return {
|
|
36
|
+
"fragment": {
|
|
37
|
+
"argumentDefinitions": [],
|
|
38
|
+
"kind": "Fragment",
|
|
39
|
+
"metadata": null,
|
|
40
|
+
"name": "ProfileDrawerContentSignOutMutation",
|
|
41
|
+
"selections": v0
|
|
42
|
+
/*: any*/
|
|
43
|
+
,
|
|
44
|
+
"type": "Mutation",
|
|
45
|
+
"abstractKey": null
|
|
46
|
+
},
|
|
47
|
+
"kind": "Request",
|
|
48
|
+
"operation": {
|
|
49
|
+
"argumentDefinitions": [],
|
|
50
|
+
"kind": "Operation",
|
|
51
|
+
"name": "ProfileDrawerContentSignOutMutation",
|
|
52
|
+
"selections": v0
|
|
53
|
+
/*: any*/
|
|
54
|
+
|
|
55
|
+
},
|
|
56
|
+
"params": {
|
|
57
|
+
"cacheID": "f5241cc562af19628cf38a9731067807",
|
|
58
|
+
"id": null,
|
|
59
|
+
"metadata": {},
|
|
60
|
+
"name": "ProfileDrawerContentSignOutMutation",
|
|
61
|
+
"operationKind": "mutation",
|
|
62
|
+
"text": "mutation ProfileDrawerContentSignOutMutation {\n signOut {\n ok\n }\n}\n"
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}();
|
|
66
|
+
|
|
67
|
+
node.hash = "c7ca96e9e713315606b0c22d196b6f7b";
|
|
68
|
+
var _default = node;
|
|
69
|
+
exports.default = _default;
|
|
70
|
+
//# sourceMappingURL=ProfileDrawerContentSignOutMutation.graphql.js.map
|
package/dist/cjs/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lib/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.ts"],"names":["node","v0","hash"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;;AACA;AACA;AAcA,IAAMA,IAAqB,GAAI,YAAU;AACzC,MAAIC,EAAE,GAAG,CACP;AACE,aAAS,IADX;AAEE,YAAQ,IAFV;AAGE,oBAAgB,eAHlB;AAIE,YAAQ,aAJV;AAKE,YAAQ,SALV;AAME,cAAU,KANZ;AAOE,kBAAc,CACZ;AACE,eAAS,IADX;AAEE,cAAQ,IAFV;AAGE,cAAQ,aAHV;AAIE,cAAQ,IAJV;AAKE,oBAAc;AALhB,KADY,CAPhB;AAgBE,kBAAc;AAhBhB,GADO,CAAT;AAoBA,SAAO;AACL,gBAAY;AACV,6BAAuB,EADb;AAEV,cAAQ,UAFE;AAGV,kBAAY,IAHF;AAIV,cAAQ,qCAJE;AAKV,oBAAeA;AAAE;AALP;AAMV,cAAQ,UANE;AAOV,qBAAe;AAPL,KADP;AAUL,YAAQ,SAVH;AAWL,iBAAa;AACX,6BAAuB,EADZ;AAEX,cAAQ,WAFG;AAGX,cAAQ,qCAHG;AAIX,oBAAeA;AAAE;;AAJN,KAXR;AAiBL,cAAU;AACR,iBAAW,kCADH;AAER,YAAM,IAFE;AAGR,kBAAY,EAHJ;AAIR,cAAQ,qCAJA;AAKR,uBAAiB,UALT;AAMR,cAAQ;AANA;AAjBL,GAAP;AA0BC,CA/C6B,EAA9B;;AAiDCD,IAAD,CAAcE,IAAd,GAAqB,kCAArB;eAEeF,I","sourcesContent":["/**\n * @generated SignedSource<<832737ac96fa474b0ed0902ff8d86b14>>\n * @lightSyntaxTransform\n * @nogrep\n */\n\n/* tslint:disable */\n/* eslint-disable */\n// @ts-nocheck\n\nimport { ConcreteRequest, Mutation } from 'relay-runtime';\nexport type ProfileDrawerContentSignOutMutation$variables = {};\nexport type ProfileDrawerContentSignOutMutation$data = {\n readonly signOut: {\n readonly ok: boolean;\n };\n};\nexport type ProfileDrawerContentSignOutMutation = {\n variables: ProfileDrawerContentSignOutMutation$variables;\n response: ProfileDrawerContentSignOutMutation$data;\n};\n\nconst node: ConcreteRequest = (function(){\nvar v0 = [\n {\n \"alias\": null,\n \"args\": null,\n \"concreteType\": \"StatusPayload\",\n \"kind\": \"LinkedField\",\n \"name\": \"signOut\",\n \"plural\": false,\n \"selections\": [\n {\n \"alias\": null,\n \"args\": null,\n \"kind\": \"ScalarField\",\n \"name\": \"ok\",\n \"storageKey\": null\n }\n ],\n \"storageKey\": null\n }\n];\nreturn {\n \"fragment\": {\n \"argumentDefinitions\": [],\n \"kind\": \"Fragment\",\n \"metadata\": null,\n \"name\": \"ProfileDrawerContentSignOutMutation\",\n \"selections\": (v0/*: any*/),\n \"type\": \"Mutation\",\n \"abstractKey\": null\n },\n \"kind\": \"Request\",\n \"operation\": {\n \"argumentDefinitions\": [],\n \"kind\": \"Operation\",\n \"name\": \"ProfileDrawerContentSignOutMutation\",\n \"selections\": (v0/*: any*/)\n },\n \"params\": {\n \"cacheID\": \"f5241cc562af19628cf38a9731067807\",\n \"id\": null,\n \"metadata\": {},\n \"name\": \"ProfileDrawerContentSignOutMutation\",\n \"operationKind\": \"mutation\",\n \"text\": \"mutation ProfileDrawerContentSignOutMutation {\\n signOut {\\n ok\\n }\\n}\\n\"\n }\n};\n})();\n\n(node as any).hash = \"c7ca96e9e713315606b0c22d196b6f7b\";\n\nexport default node;\n"],"file":"ProfileDrawerContentSignOutMutation.graphql.js"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @generated SignedSource<<dfa244a4ba1902852ff99f94a3333fa7>>
|
|
10
|
+
* @lightSyntaxTransform
|
|
11
|
+
* @nogrep
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/* tslint:disable */
|
|
15
|
+
|
|
16
|
+
/* eslint-disable */
|
|
17
|
+
// @ts-nocheck
|
|
18
|
+
var node = function () {
|
|
19
|
+
var v0 = [{
|
|
20
|
+
"defaultValue": null,
|
|
21
|
+
"kind": "LocalArgument",
|
|
22
|
+
"name": "input"
|
|
23
|
+
}],
|
|
24
|
+
v1 = [{
|
|
25
|
+
"alias": null,
|
|
26
|
+
"args": [{
|
|
27
|
+
"kind": "Variable",
|
|
28
|
+
"name": "input",
|
|
29
|
+
"variableName": "input"
|
|
30
|
+
}],
|
|
31
|
+
"concreteType": "User",
|
|
32
|
+
"kind": "LinkedField",
|
|
33
|
+
"name": "updateAvatar",
|
|
34
|
+
"plural": false,
|
|
35
|
+
"selections": [{
|
|
36
|
+
"alias": null,
|
|
37
|
+
"args": null,
|
|
38
|
+
"kind": "ScalarField",
|
|
39
|
+
"name": "id",
|
|
40
|
+
"storageKey": null
|
|
41
|
+
}, {
|
|
42
|
+
"alias": null,
|
|
43
|
+
"args": null,
|
|
44
|
+
"kind": "ScalarField",
|
|
45
|
+
"name": "avatar",
|
|
46
|
+
"storageKey": null
|
|
47
|
+
}],
|
|
48
|
+
"storageKey": null
|
|
49
|
+
}];
|
|
50
|
+
return {
|
|
51
|
+
"fragment": {
|
|
52
|
+
"argumentDefinitions": v0
|
|
53
|
+
/*: any*/
|
|
54
|
+
,
|
|
55
|
+
"kind": "Fragment",
|
|
56
|
+
"metadata": null,
|
|
57
|
+
"name": "ProfileDrawerContentUpdateAvatarMutation",
|
|
58
|
+
"selections": v1
|
|
59
|
+
/*: any*/
|
|
60
|
+
,
|
|
61
|
+
"type": "Mutation",
|
|
62
|
+
"abstractKey": null
|
|
63
|
+
},
|
|
64
|
+
"kind": "Request",
|
|
65
|
+
"operation": {
|
|
66
|
+
"argumentDefinitions": v0
|
|
67
|
+
/*: any*/
|
|
68
|
+
,
|
|
69
|
+
"kind": "Operation",
|
|
70
|
+
"name": "ProfileDrawerContentUpdateAvatarMutation",
|
|
71
|
+
"selections": v1
|
|
72
|
+
/*: any*/
|
|
73
|
+
|
|
74
|
+
},
|
|
75
|
+
"params": {
|
|
76
|
+
"cacheID": "b749732615af9f8027386d69ffb57b63",
|
|
77
|
+
"id": null,
|
|
78
|
+
"metadata": {},
|
|
79
|
+
"name": "ProfileDrawerContentUpdateAvatarMutation",
|
|
80
|
+
"operationKind": "mutation",
|
|
81
|
+
"text": "mutation ProfileDrawerContentUpdateAvatarMutation(\n $input: UpdateAvatarInput!\n) {\n updateAvatar(input: $input) {\n id\n avatar\n }\n}\n"
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}();
|
|
85
|
+
|
|
86
|
+
node.hash = "cf72a6314772ed0d1f182b197c858505";
|
|
87
|
+
var _default = node;
|
|
88
|
+
exports.default = _default;
|
|
89
|
+
//# sourceMappingURL=ProfileDrawerContentUpdateAvatarMutation.graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lib/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.ts"],"names":["node","v0","v1","hash"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;;AACA;AACA;AAoBA,IAAMA,IAAqB,GAAI,YAAU;AACzC,MAAIC,EAAE,GAAG,CACP;AACE,oBAAgB,IADlB;AAEE,YAAQ,eAFV;AAGE,YAAQ;AAHV,GADO,CAAT;AAAA,MAOAC,EAAE,GAAG,CACH;AACE,aAAS,IADX;AAEE,YAAQ,CACN;AACE,cAAQ,UADV;AAEE,cAAQ,OAFV;AAGE,sBAAgB;AAHlB,KADM,CAFV;AASE,oBAAgB,MATlB;AAUE,YAAQ,aAVV;AAWE,YAAQ,cAXV;AAYE,cAAU,KAZZ;AAaE,kBAAc,CACZ;AACE,eAAS,IADX;AAEE,cAAQ,IAFV;AAGE,cAAQ,aAHV;AAIE,cAAQ,IAJV;AAKE,oBAAc;AALhB,KADY,EAQZ;AACE,eAAS,IADX;AAEE,cAAQ,IAFV;AAGE,cAAQ,aAHV;AAIE,cAAQ,QAJV;AAKE,oBAAc;AALhB,KARY,CAbhB;AA6BE,kBAAc;AA7BhB,GADG,CAPL;AAwCA,SAAO;AACL,gBAAY;AACV,6BAAwBD;AAAE;AADhB;AAEV,cAAQ,UAFE;AAGV,kBAAY,IAHF;AAIV,cAAQ,0CAJE;AAKV,oBAAeC;AAAE;AALP;AAMV,cAAQ,UANE;AAOV,qBAAe;AAPL,KADP;AAUL,YAAQ,SAVH;AAWL,iBAAa;AACX,6BAAwBD;AAAE;AADf;AAEX,cAAQ,WAFG;AAGX,cAAQ,0CAHG;AAIX,oBAAeC;AAAE;;AAJN,KAXR;AAiBL,cAAU;AACR,iBAAW,kCADH;AAER,YAAM,IAFE;AAGR,kBAAY,EAHJ;AAIR,cAAQ,0CAJA;AAKR,uBAAiB,UALT;AAMR,cAAQ;AANA;AAjBL,GAAP;AA0BC,CAnE6B,EAA9B;;AAqECF,IAAD,CAAcG,IAAd,GAAqB,kCAArB;eAEeH,I","sourcesContent":["/**\n * @generated SignedSource<<dfa244a4ba1902852ff99f94a3333fa7>>\n * @lightSyntaxTransform\n * @nogrep\n */\n\n/* tslint:disable */\n/* eslint-disable */\n// @ts-nocheck\n\nimport { ConcreteRequest, Mutation } from 'relay-runtime';\nexport type UpdateAvatarInput = {\n avatar?: any | null;\n};\nexport type ProfileDrawerContentUpdateAvatarMutation$variables = {\n input: UpdateAvatarInput;\n};\nexport type ProfileDrawerContentUpdateAvatarMutation$data = {\n readonly updateAvatar: {\n readonly id: string;\n readonly avatar: string | null;\n };\n};\nexport type ProfileDrawerContentUpdateAvatarMutation = {\n variables: ProfileDrawerContentUpdateAvatarMutation$variables;\n response: ProfileDrawerContentUpdateAvatarMutation$data;\n};\n\nconst node: ConcreteRequest = (function(){\nvar v0 = [\n {\n \"defaultValue\": null,\n \"kind\": \"LocalArgument\",\n \"name\": \"input\"\n }\n],\nv1 = [\n {\n \"alias\": null,\n \"args\": [\n {\n \"kind\": \"Variable\",\n \"name\": \"input\",\n \"variableName\": \"input\"\n }\n ],\n \"concreteType\": \"User\",\n \"kind\": \"LinkedField\",\n \"name\": \"updateAvatar\",\n \"plural\": false,\n \"selections\": [\n {\n \"alias\": null,\n \"args\": null,\n \"kind\": \"ScalarField\",\n \"name\": \"id\",\n \"storageKey\": null\n },\n {\n \"alias\": null,\n \"args\": null,\n \"kind\": \"ScalarField\",\n \"name\": \"avatar\",\n \"storageKey\": null\n }\n ],\n \"storageKey\": null\n }\n];\nreturn {\n \"fragment\": {\n \"argumentDefinitions\": (v0/*: any*/),\n \"kind\": \"Fragment\",\n \"metadata\": null,\n \"name\": \"ProfileDrawerContentUpdateAvatarMutation\",\n \"selections\": (v1/*: any*/),\n \"type\": \"Mutation\",\n \"abstractKey\": null\n },\n \"kind\": \"Request\",\n \"operation\": {\n \"argumentDefinitions\": (v0/*: any*/),\n \"kind\": \"Operation\",\n \"name\": \"ProfileDrawerContentUpdateAvatarMutation\",\n \"selections\": (v1/*: any*/)\n },\n \"params\": {\n \"cacheID\": \"b749732615af9f8027386d69ffb57b63\",\n \"id\": null,\n \"metadata\": {},\n \"name\": \"ProfileDrawerContentUpdateAvatarMutation\",\n \"operationKind\": \"mutation\",\n \"text\": \"mutation ProfileDrawerContentUpdateAvatarMutation(\\n $input: UpdateAvatarInput!\\n) {\\n updateAvatar(input: $input) {\\n id\\n avatar\\n }\\n}\\n\"\n }\n};\n})();\n\n(node as any).hash = \"cf72a6314772ed0d1f182b197c858505\";\n\nexport default node;\n"],"file":"ProfileDrawerContentUpdateAvatarMutation.graphql.js"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.default = void 0;
|
|
9
7
|
|
|
10
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
9
|
|
|
12
10
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
13
11
|
|
|
@@ -19,20 +17,27 @@ var _theming = require("@os-design/theming");
|
|
|
19
17
|
|
|
20
18
|
var _media = require("@os-design/media");
|
|
21
19
|
|
|
22
|
-
var
|
|
20
|
+
var _SessionListSkeleton = _interopRequireDefault(require("./SessionListSkeleton"));
|
|
23
21
|
|
|
24
22
|
var _templateObject, _templateObject2;
|
|
25
23
|
|
|
26
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
-
|
|
28
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
-
|
|
30
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
25
|
|
|
26
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
27
|
+
|
|
32
28
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
33
29
|
|
|
34
30
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
35
31
|
|
|
32
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
|
+
|
|
34
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
|
+
|
|
36
|
+
var LazySessionDrawerContent = /*#__PURE__*/(0, _react.lazy)(function () {
|
|
37
|
+
return Promise.resolve().then(function () {
|
|
38
|
+
return _interopRequireWildcard(require('./SessionDrawerContent'));
|
|
39
|
+
});
|
|
40
|
+
});
|
|
36
41
|
var StyledPageHeader = (0, _styled.default)(_core.PageHeader)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n"])));
|
|
37
42
|
var StyledAlert = (0, _styled.default)(_core.Alert)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border-radius: 0;\n"])));
|
|
38
43
|
|
|
@@ -46,14 +51,16 @@ var SessionDrawer = function SessionDrawer(props) {
|
|
|
46
51
|
width: isMinSm ? '24em' : '90%'
|
|
47
52
|
}, props), /*#__PURE__*/_react.default.createElement(_theming.ThemeOverrider, {
|
|
48
53
|
overrides: {
|
|
49
|
-
horizontalPadding: [
|
|
54
|
+
horizontalPadding: [1, 1]
|
|
50
55
|
}
|
|
51
56
|
}, /*#__PURE__*/_react.default.createElement(_core.Layout, null, /*#__PURE__*/_react.default.createElement(StyledPageHeader, {
|
|
52
57
|
title: t('profile:sessions.title')
|
|
53
58
|
}), /*#__PURE__*/_react.default.createElement(StyledAlert, {
|
|
54
59
|
type: "info",
|
|
55
60
|
size: "small"
|
|
56
|
-
}, t('profile:sessions.description')), /*#__PURE__*/_react.default.createElement(
|
|
61
|
+
}, t('profile:sessions.description')), /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
62
|
+
fallback: /*#__PURE__*/_react.default.createElement(_SessionListSkeleton.default, null)
|
|
63
|
+
}, /*#__PURE__*/_react.default.createElement(LazySessionDrawerContent, null)))));
|
|
57
64
|
};
|
|
58
65
|
|
|
59
66
|
var _default = SessionDrawer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/session/SessionDrawer.tsx"],"names":["StyledPageHeader","PageHeader","StyledAlert","Alert","SessionDrawer","props","t","isMinSm","horizontalPadding"
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/components/session/SessionDrawer.tsx"],"names":["LazySessionDrawerContent","StyledPageHeader","PageHeader","StyledAlert","Alert","SessionDrawer","props","t","isMinSm","horizontalPadding"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;AAEA,IAAMA,wBAAwB,gBAAG,iBAAK;AAAA;AAAA,2CAAa,wBAAb;AAAA;AAAA,CAAL,CAAjC;AAEA,IAAMC,gBAAgB,GAAG,qBAAOC,gBAAP,CAAH,8FAAtB;AAIA,IAAMC,WAAW,GAAG,qBAAOC,WAAP,CAAH,8FAAjB;;AAIA,IAAMC,aAAoC,GAAG,SAAvCA,aAAuC,CAACC,KAAD,EAAW;AACtD,wBAAc,kCAAe,SAAf,CAAd;AAAA,MAAQC,CAAR,mBAAQA,CAAR;;AACA,MAAMC,OAAO,GAAG,0BAAc,IAAd,CAAhB;AAEA,sBACE,6BAAC,YAAD;AAAQ,IAAA,SAAS,EAAC,OAAlB;AAA0B,IAAA,KAAK,EAAEA,OAAO,GAAG,MAAH,GAAY;AAApD,KAA+DF,KAA/D,gBACE,6BAAC,uBAAD;AAAgB,IAAA,SAAS,EAAE;AAAEG,MAAAA,iBAAiB,EAAE,CAAC,CAAD,EAAI,CAAJ;AAArB;AAA3B,kBACE,6BAAC,YAAD,qBACE,6BAAC,gBAAD;AAAkB,IAAA,KAAK,EAAEF,CAAC,CAAC,wBAAD;AAA1B,IADF,eAGE,6BAAC,WAAD;AAAa,IAAA,IAAI,EAAC,MAAlB;AAAyB,IAAA,IAAI,EAAC;AAA9B,KACGA,CAAC,CAAC,8BAAD,CADJ,CAHF,eAOE,6BAAC,eAAD;AAAU,IAAA,QAAQ,eAAE,6BAAC,4BAAD;AAApB,kBACE,6BAAC,wBAAD,OADF,CAPF,CADF,CADF,CADF;AAiBD,CArBD;;eAuBeF,a","sourcesContent":["import React, { lazy, Suspense } from 'react';\nimport styled from '@emotion/styled';\nimport {\n Alert,\n Drawer,\n DrawerProps,\n Layout,\n PageHeader,\n} from '@os-design/core';\nimport { useTranslation } from 'react-i18next';\nimport { ThemeOverrider } from '@os-design/theming';\nimport { useIsMinWidth } from '@os-design/media';\nimport SessionListSkeleton from './SessionListSkeleton';\n\nconst LazySessionDrawerContent = lazy(() => import('./SessionDrawerContent'));\n\nconst StyledPageHeader = styled(PageHeader)`\n position: relative;\n`;\n\nconst StyledAlert = styled(Alert)`\n border-radius: 0;\n`;\n\nconst SessionDrawer: React.FC<DrawerProps> = (props) => {\n const { t } = useTranslation('profile');\n const isMinSm = useIsMinWidth('sm');\n\n return (\n <Drawer placement='right' width={isMinSm ? '24em' : '90%'} {...props}>\n <ThemeOverrider overrides={{ horizontalPadding: [1, 1] }}>\n <Layout>\n <StyledPageHeader title={t('profile:sessions.title')} />\n\n <StyledAlert type='info' size='small'>\n {t('profile:sessions.description')}\n </StyledAlert>\n\n <Suspense fallback={<SessionListSkeleton />}>\n <LazySessionDrawerContent />\n </Suspense>\n </Layout>\n </ThemeOverrider>\n </Drawer>\n );\n};\n\nexport default SessionDrawer;\n"],"file":"SessionDrawer.js"}
|
|
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default =
|
|
8
|
+
exports.default = void 0;
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
@@ -27,9 +27,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
27
27
|
|
|
28
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
29
|
|
|
30
|
-
var SESSION_HORIZONTAL_PADDING = 1;
|
|
31
|
-
exports.SESSION_HORIZONTAL_PADDING = SESSION_HORIZONTAL_PADDING;
|
|
32
|
-
|
|
33
30
|
var SessionDrawerContentLoader = function SessionDrawerContentLoader() {
|
|
34
31
|
var props = (0, _hooks.useLazyLoadQuery)(_SessionDrawerContentQuery !== void 0 ? _SessionDrawerContentQuery : (_SessionDrawerContentQuery = require("./__generated__/SessionDrawerContentQuery.graphql"), _SessionDrawerContentQuery.hash && _SessionDrawerContentQuery.hash !== "1643ac6b9bd324d389dab9011e55b1ba" && console.error("The definition of 'SessionDrawerContentQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _SessionDrawerContentQuery), {}, {
|
|
35
32
|
fetchPolicy: 'network-only'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/session/SessionDrawerContent.tsx"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/components/session/SessionDrawerContent.tsx"],"names":["SessionDrawerContentLoader","props","fetchPolicy","errorFallback","error","SessionDrawerContent"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;AAGA,IAAMA,0BAAoC,GAAG,SAAvCA,0BAAuC,GAAM;AACjD,MAAMC,KAAK,GAAG,kfAMZ,EANY,EAOZ;AAAEC,IAAAA,WAAW,EAAE;AAAf,GAPY,CAAd;AAUA,sBAAO,6BAAC,oBAAD;AAAa,IAAA,WAAW,EAAED;AAA1B,IAAP;AACD,CAZD;;AAcA,IAAME,aAAa,GAAG,SAAhBA,aAAgB;AAAA,MAAGC,KAAH,QAAGA,KAAH;AAAA,sBAAe,6BAAC,oBAAD;AAAa,IAAA,KAAK,EAAEA;AAApB,IAAf;AAAA,CAAtB;;AAEA,IAAMC,oBAA8B,GAAG,SAAjCA,oBAAiC;AAAA,sBACrC,6BAAC,oBAAD;AAAe,IAAA,QAAQ,EAAEF;AAAzB,kBACE,6BAAC,eAAD;AAAU,IAAA,QAAQ,eAAE,6BAAC,4BAAD;AAApB,kBACE,6BAAC,0BAAD,OADF,CADF,CADqC;AAAA,CAAvC;;eAQeE,oB","sourcesContent":["import React, { Suspense } from 'react';\nimport { useLazyLoadQuery } from 'react-relay/hooks';\nimport { ErrorBoundary } from '@os-design/utils';\nimport graphql from 'babel-plugin-relay/macro';\nimport ErrorResult from '../shared/ErrorResult';\nimport SessionList from './SessionList';\nimport SessionListSkeleton from './SessionListSkeleton';\nimport { SessionDrawerContentQuery } from './__generated__/SessionDrawerContentQuery.graphql';\n\nconst SessionDrawerContentLoader: React.FC = () => {\n const props = useLazyLoadQuery<SessionDrawerContentQuery>(\n graphql`\n query SessionDrawerContentQuery {\n ...SessionList_sessions\n }\n `,\n {},\n { fetchPolicy: 'network-only' }\n );\n\n return <SessionList sessionsKey={props} />;\n};\n\nconst errorFallback = ({ error }) => <ErrorResult error={error} />;\n\nconst SessionDrawerContent: React.FC = () => (\n <ErrorBoundary fallback={errorFallback}>\n <Suspense fallback={<SessionListSkeleton />}>\n <SessionDrawerContentLoader />\n </Suspense>\n </ErrorBoundary>\n);\n\nexport default SessionDrawerContent;\n"],"file":"SessionDrawerContent.js"}
|
|
@@ -1,212 +1,28 @@
|
|
|
1
|
-
var _ProfileDrawerUpdateAvatarMutation, _ProfileDrawerSignOutMutation;
|
|
2
|
-
|
|
3
1
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
2
|
|
|
5
|
-
import React, {
|
|
6
|
-
import { Drawer
|
|
3
|
+
import React, { lazy, Suspense } from 'react';
|
|
4
|
+
import { Drawer } from '@os-design/core';
|
|
7
5
|
import styled from '@emotion/styled';
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import { useMutation } from 'react-relay/hooks';
|
|
11
|
-
import { useProfile } from './ProfileContext';
|
|
12
|
-
import UserAvatar from './UserAvatar';
|
|
13
|
-
import ProfileButton from './ProfileButton';
|
|
14
|
-
import ProfileUpdateNameModal from './ProfileUpdateNameModal';
|
|
15
|
-
import ProfileUpdatePasswordModal from './ProfileUpdatePasswordModal';
|
|
6
|
+
import MainLoader from '../shared/MainLoader';
|
|
7
|
+
const LazyProfileDrawerContent = /*#__PURE__*/lazy(() => import('./ProfileDrawerContent'));
|
|
16
8
|
const StyledDrawer = styled(Drawer)`
|
|
17
9
|
display: flex;
|
|
18
10
|
flex-direction: column;
|
|
19
11
|
padding: 2em 1em;
|
|
20
12
|
`;
|
|
21
|
-
const AvatarContainer = styled.div`
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
justify-content: center;
|
|
25
|
-
align-items: center;
|
|
26
|
-
`;
|
|
27
|
-
const UserContent = styled.div`
|
|
28
|
-
margin-top: 1em;
|
|
29
|
-
`;
|
|
30
|
-
const FullName = styled.div`
|
|
31
|
-
font-size: ${p => p.theme.sizes.large}em;
|
|
32
|
-
font-weight: 500;
|
|
33
|
-
text-align: center;
|
|
34
|
-
line-height: 1.2;
|
|
35
|
-
`;
|
|
36
|
-
const Email = styled.div`
|
|
37
|
-
color: ${p => clr(p.theme.inputColorPlaceholder)};
|
|
38
|
-
margin-top: 0.2em;
|
|
39
|
-
text-align: center;
|
|
40
|
-
`;
|
|
41
|
-
const ActionsContainer = styled.div`
|
|
42
|
-
margin-top: 1.5em;
|
|
43
|
-
`;
|
|
44
|
-
const Footer = styled.div`
|
|
45
|
-
display: flex;
|
|
46
|
-
justify-content: center;
|
|
47
|
-
margin-top: auto;
|
|
48
|
-
padding-top: 1.5em;
|
|
49
|
-
`;
|
|
50
|
-
const HiddenInput = styled.input`
|
|
51
|
-
display: none;
|
|
52
|
-
`;
|
|
53
|
-
const profileDrawerUpdateAvatarMutation = _ProfileDrawerUpdateAvatarMutation !== void 0 ? _ProfileDrawerUpdateAvatarMutation : (_ProfileDrawerUpdateAvatarMutation = require("./__generated__/ProfileDrawerUpdateAvatarMutation.graphql"), _ProfileDrawerUpdateAvatarMutation.hash && _ProfileDrawerUpdateAvatarMutation.hash !== "c129cb1974b7cb9090d6c5df4e0f790d" && console.error("The definition of 'ProfileDrawerUpdateAvatarMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _ProfileDrawerUpdateAvatarMutation);
|
|
54
|
-
|
|
55
|
-
const DeleteAvatarButton = () => {
|
|
56
|
-
const {
|
|
57
|
-
t
|
|
58
|
-
} = useTranslation('profile');
|
|
59
|
-
const [commit, loading] = useMutation(profileDrawerUpdateAvatarMutation);
|
|
60
|
-
const handler = useCallback(() => {
|
|
61
|
-
commit({
|
|
62
|
-
variables: {
|
|
63
|
-
input: {
|
|
64
|
-
avatar: null
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
onError: error => {
|
|
68
|
-
var _source, _source$errors, _source$errors$;
|
|
69
|
-
|
|
70
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
71
|
-
message.error((_source = error.source) === null || _source === void 0 ? void 0 : (_source$errors = _source.errors) === null || _source$errors === void 0 ? void 0 : (_source$errors$ = _source$errors[0]) === null || _source$errors$ === void 0 ? void 0 : _source$errors$.message);
|
|
72
|
-
},
|
|
73
|
-
onCompleted: () => {
|
|
74
|
-
message.success(t('profile:updated'));
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}, [commit, t]);
|
|
78
|
-
return /*#__PURE__*/React.createElement(ProfileButton, {
|
|
79
|
-
loading: loading,
|
|
80
|
-
onClick: handler
|
|
81
|
-
}, t('profile:deleteAvatar'));
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const UpdateAvatarButton = ({
|
|
85
|
-
hasAvatar
|
|
86
|
-
}) => {
|
|
87
|
-
const {
|
|
88
|
-
t
|
|
89
|
-
} = useTranslation('profile');
|
|
90
|
-
const fileInputRef = useRef(null);
|
|
91
|
-
const [commit, loading] = useMutation(profileDrawerUpdateAvatarMutation);
|
|
92
|
-
const handler = useCallback(e => {
|
|
93
|
-
const target = e.target;
|
|
94
|
-
if (!target) return;
|
|
95
|
-
const {
|
|
96
|
-
files
|
|
97
|
-
} = target;
|
|
98
|
-
if (!files) return;
|
|
99
|
-
const file = files[0];
|
|
100
|
-
commit({
|
|
101
|
-
variables: {
|
|
102
|
-
input: {}
|
|
103
|
-
},
|
|
104
|
-
uploadables: {
|
|
105
|
-
avatar: file
|
|
106
|
-
},
|
|
107
|
-
onError: error => {
|
|
108
|
-
var _source2, _source2$errors, _source2$errors$;
|
|
109
|
-
|
|
110
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
111
|
-
message.error((_source2 = error.source) === null || _source2 === void 0 ? void 0 : (_source2$errors = _source2.errors) === null || _source2$errors === void 0 ? void 0 : (_source2$errors$ = _source2$errors[0]) === null || _source2$errors$ === void 0 ? void 0 : _source2$errors$.message);
|
|
112
|
-
},
|
|
113
|
-
onCompleted: () => {
|
|
114
|
-
message.success(t('profile:updated'));
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
}, [commit, t]);
|
|
118
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProfileButton, {
|
|
119
|
-
loading: loading,
|
|
120
|
-
onClick: () => {
|
|
121
|
-
if (!fileInputRef.current) return;
|
|
122
|
-
fileInputRef.current.value = '';
|
|
123
|
-
fileInputRef.current.click();
|
|
124
|
-
}
|
|
125
|
-
}, t(`profile:${hasAvatar ? 'changeAvatar' : 'setAvatar'}`)), /*#__PURE__*/React.createElement(HiddenInput, {
|
|
126
|
-
type: "file",
|
|
127
|
-
accept: "image/jpeg,image/png,image/webp",
|
|
128
|
-
onChange: handler,
|
|
129
|
-
ref: fileInputRef
|
|
130
|
-
}));
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const UpdateNameButton = ({
|
|
134
|
-
hasName
|
|
135
|
-
}) => {
|
|
136
|
-
const {
|
|
137
|
-
t
|
|
138
|
-
} = useTranslation('profile');
|
|
139
|
-
const [modalVisibility, setModalVisibility] = useState(false);
|
|
140
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProfileButton, {
|
|
141
|
-
onClick: () => setModalVisibility(true)
|
|
142
|
-
}, t(`profile:${hasName ? 'changeName' : 'setName'}`)), /*#__PURE__*/React.createElement(ProfileUpdateNameModal, {
|
|
143
|
-
visibility: modalVisibility,
|
|
144
|
-
onClose: () => setModalVisibility(false)
|
|
145
|
-
}));
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
const ChangePasswordButton = () => {
|
|
149
|
-
const {
|
|
150
|
-
t
|
|
151
|
-
} = useTranslation('profile');
|
|
152
|
-
const [modalVisibility, setModalVisibility] = useState(false);
|
|
153
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProfileButton, {
|
|
154
|
-
onClick: () => setModalVisibility(true)
|
|
155
|
-
}, t('profile:changePassword')), /*#__PURE__*/React.createElement(ProfileUpdatePasswordModal, {
|
|
156
|
-
visibility: modalVisibility,
|
|
157
|
-
onClose: () => setModalVisibility(false)
|
|
158
|
-
}));
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
const SignOutButton = () => {
|
|
162
|
-
const {
|
|
163
|
-
t
|
|
164
|
-
} = useTranslation('profile');
|
|
165
|
-
const [commit, loading] = useMutation(_ProfileDrawerSignOutMutation !== void 0 ? _ProfileDrawerSignOutMutation : (_ProfileDrawerSignOutMutation = require("./__generated__/ProfileDrawerSignOutMutation.graphql"), _ProfileDrawerSignOutMutation.hash && _ProfileDrawerSignOutMutation.hash !== "8510e6462e8f7839ce100254080ba293" && console.error("The definition of 'ProfileDrawerSignOutMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _ProfileDrawerSignOutMutation));
|
|
166
|
-
const handler = useCallback(() => {
|
|
167
|
-
commit({
|
|
168
|
-
variables: {},
|
|
169
|
-
onError: error => {
|
|
170
|
-
var _source3, _source3$errors, _source3$errors$;
|
|
171
|
-
|
|
172
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
173
|
-
message.error((_source3 = error.source) === null || _source3 === void 0 ? void 0 : (_source3$errors = _source3.errors) === null || _source3$errors === void 0 ? void 0 : (_source3$errors$ = _source3$errors[0]) === null || _source3$errors$ === void 0 ? void 0 : _source3$errors$.message);
|
|
174
|
-
},
|
|
175
|
-
onCompleted: () => {
|
|
176
|
-
window.location.href = '/auth/';
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
}, [commit]);
|
|
180
|
-
return /*#__PURE__*/React.createElement(ProfileButton, {
|
|
181
|
-
danger: true,
|
|
182
|
-
loading: loading,
|
|
183
|
-
onClick: handler
|
|
184
|
-
}, t('profile:signOut'));
|
|
185
|
-
};
|
|
186
13
|
|
|
187
14
|
const ProfileDrawer = ({
|
|
188
15
|
actions,
|
|
189
16
|
children,
|
|
190
17
|
...rest
|
|
191
|
-
}) => {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
return /*#__PURE__*/React.createElement(StyledDrawer, _extends({
|
|
200
|
-
placement: "right",
|
|
201
|
-
width: "15em"
|
|
202
|
-
}, rest), /*#__PURE__*/React.createElement(AvatarContainer, null, /*#__PURE__*/React.createElement(UserAvatar, {
|
|
203
|
-
size: "10em"
|
|
204
|
-
}), /*#__PURE__*/React.createElement(UserContent, null, fullName && /*#__PURE__*/React.createElement(FullName, null, fullName), /*#__PURE__*/React.createElement(Email, null, email))), /*#__PURE__*/React.createElement(ActionsContainer, null, avatar && /*#__PURE__*/React.createElement(DeleteAvatarButton, null), /*#__PURE__*/React.createElement(UpdateAvatarButton, {
|
|
205
|
-
hasAvatar: !!avatar
|
|
206
|
-
}), /*#__PURE__*/React.createElement(UpdateNameButton, {
|
|
207
|
-
hasName: !!fullName
|
|
208
|
-
}), /*#__PURE__*/React.createElement(ChangePasswordButton, null), actions, /*#__PURE__*/React.createElement(SignOutButton, null), children), /*#__PURE__*/React.createElement(Footer, null, /*#__PURE__*/React.createElement(ThemeSwitcher, null)));
|
|
209
|
-
};
|
|
18
|
+
}) => /*#__PURE__*/React.createElement(StyledDrawer, _extends({
|
|
19
|
+
placement: "right",
|
|
20
|
+
width: "15em"
|
|
21
|
+
}, rest), /*#__PURE__*/React.createElement(Suspense, {
|
|
22
|
+
fallback: /*#__PURE__*/React.createElement(MainLoader, null)
|
|
23
|
+
}, /*#__PURE__*/React.createElement(LazyProfileDrawerContent, {
|
|
24
|
+
actions: actions
|
|
25
|
+
}, children)));
|
|
210
26
|
|
|
211
27
|
export default ProfileDrawer;
|
|
212
28
|
//# sourceMappingURL=ProfileDrawer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileDrawer.tsx"],"names":["React","useCallback","useMemo","useRef","useState","Drawer","message","ThemeSwitcher","styled","clr","useTranslation","useMutation","useProfile","UserAvatar","ProfileButton","ProfileUpdateNameModal","ProfileUpdatePasswordModal","StyledDrawer","AvatarContainer","div","UserContent","FullName","p","theme","sizes","large","Email","inputColorPlaceholder","ActionsContainer","Footer","HiddenInput","input","profileDrawerUpdateAvatarMutation","DeleteAvatarButton","t","commit","loading","handler","variables","avatar","onError","error","source","errors","onCompleted","success","UpdateAvatarButton","hasAvatar","fileInputRef","e","target","files","file","uploadables","current","value","click","UpdateNameButton","hasName","modalVisibility","setModalVisibility","ChangePasswordButton","SignOutButton","window","location","href","ProfileDrawer","actions","children","rest","email","firstName","l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gBAAD,QACG/B,MAAM,iBAAI,oBAAC,kBAAD,OADb,eAGE,oBAAC,kBAAD;AAAoB,IAAA,SAAS,EAAE,CAAC,CAACA;AAAjC,IAHF,eAIE,oBAAC,gBAAD;AAAkB,IAAA,OAAO,EAAE,CAAC,CAACkC;AAA7B,IAJF,eAKE,oBAAC,oBAAD,OALF,EAOGN,OAPH,eASE,oBAAC,aAAD,OATF,EAWGC,QAXH,CATF,eAuBE,oBAAC,MAAD,qBACE,oBAAC,aAAD,OADF,CAvBF,CADF;AA6BD,CAzCD;;AA2CA,eAAeF,aAAf","sourcesContent":["import React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { Drawer, DrawerProps, message, ThemeSwitcher } from '@os-design/core';\nimport styled from '@emotion/styled';\nimport { clr } from '@os-design/theming';\nimport { useTranslation } from 'react-i18next';\nimport { graphql } from 'babel-plugin-relay/macro';\nimport { useMutation } from 'react-relay/hooks';\nimport { useProfile } from './ProfileContext';\nimport UserAvatar from './UserAvatar';\nimport ProfileButton from './ProfileButton';\nimport ProfileUpdateNameModal from './ProfileUpdateNameModal';\nimport ProfileUpdatePasswordModal from './ProfileUpdatePasswordModal';\nimport { ProfileDrawerSignOutMutation } from './__generated__/ProfileDrawerSignOutMutation.graphql';\nimport { ProfileDrawerUpdateAvatarMutation } from './__generated__/ProfileDrawerUpdateAvatarMutation.graphql';\n\nexport interface ProfileDrawerProps extends DrawerProps {\n /**\n * Additional actions placed under the avatar.\n * @default undefined\n */\n actions?: React.ReactNode;\n}\n\nconst StyledDrawer = styled(Drawer)`\n display: flex;\n flex-direction: column;\n padding: 2em 1em;\n`;\n\nconst AvatarContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n`;\n\nconst UserContent = styled.div`\n margin-top: 1em;\n`;\n\nconst FullName = styled.div`\n font-size: ${(p) => p.theme.sizes.large}em;\n font-weight: 500;\n text-align: center;\n line-height: 1.2;\n`;\n\nconst Email = styled.div`\n color: ${(p) => clr(p.theme.inputColorPlaceholder)};\n margin-top: 0.2em;\n text-align: center;\n`;\n\nconst ActionsContainer = styled.div`\n margin-top: 1.5em;\n`;\n\nconst Footer = styled.div`\n display: flex;\n justify-content: center;\n margin-top: auto;\n padding-top: 1.5em;\n`;\n\nconst HiddenInput = styled.input`\n display: none;\n`;\n\nconst profileDrawerUpdateAvatarMutation = graphql`\n mutation ProfileDrawerUpdateAvatarMutation($input: UpdateAvatarInput!) {\n updateAvatar(input: $input) {\n id\n avatar\n }\n }\n`;\n\nconst DeleteAvatarButton: React.FC = () => {\n const { t } = useTranslation('profile');\n\n const [commit, loading] = useMutation<ProfileDrawerUpdateAvatarMutation>(\n profileDrawerUpdateAvatarMutation\n );\n\n const handler = useCallback(() => {\n commit({\n variables: {\n input: { avatar: null },\n },\n onError: (error) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n message.error((error as any).source?.errors?.[0]?.message);\n },\n onCompleted: () => {\n message.success(t('profile:updated'));\n },\n });\n }, [commit, t]);\n\n return (\n <ProfileButton loading={loading} onClick={handler}>\n {t('profile:deleteAvatar')}\n </ProfileButton>\n );\n};\n\ninterface UpdateAvatarButtonProps {\n hasAvatar: boolean;\n}\n\nconst UpdateAvatarButton: React.FC<UpdateAvatarButtonProps> = ({\n hasAvatar,\n}) => {\n const { t } = useTranslation('profile');\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n const [commit, loading] = useMutation<ProfileDrawerUpdateAvatarMutation>(\n profileDrawerUpdateAvatarMutation\n );\n\n const handler = useCallback(\n (e) => {\n const target = e.target as HTMLInputElement | null;\n if (!target) return;\n\n const { files } = target;\n if (!files) return;\n\n const file = files[0];\n\n commit({\n variables: {\n input: {},\n },\n uploadables: { avatar: file },\n onError: (error) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n message.error((error as any).source?.errors?.[0]?.message);\n },\n onCompleted: () => {\n message.success(t('profile:updated'));\n },\n });\n },\n [commit, t]\n );\n\n return (\n <>\n <ProfileButton\n loading={loading}\n onClick={() => {\n if (!fileInputRef.current) return;\n fileInputRef.current.value = '';\n fileInputRef.current.click();\n }}\n >\n {t(`profile:${hasAvatar ? 'changeAvatar' : 'setAvatar'}`)}\n </ProfileButton>\n\n <HiddenInput\n type='file'\n accept='image/jpeg,image/png,image/webp'\n onChange={handler}\n ref={fileInputRef}\n />\n </>\n );\n};\n\ninterface UpdateNameButtonProps {\n hasName: boolean;\n}\n\nconst UpdateNameButton: React.FC<UpdateNameButtonProps> = ({ hasName }) => {\n const { t } = useTranslation('profile');\n const [modalVisibility, setModalVisibility] = useState(false);\n\n return (\n <>\n <ProfileButton onClick={() => setModalVisibility(true)}>\n {t(`profile:${hasName ? 'changeName' : 'setName'}`)}\n </ProfileButton>\n\n <ProfileUpdateNameModal\n visibility={modalVisibility}\n onClose={() => setModalVisibility(false)}\n />\n </>\n );\n};\n\nconst ChangePasswordButton: React.FC = () => {\n const { t } = useTranslation('profile');\n const [modalVisibility, setModalVisibility] = useState(false);\n\n return (\n <>\n <ProfileButton onClick={() => setModalVisibility(true)}>\n {t('profile:changePassword')}\n </ProfileButton>\n\n <ProfileUpdatePasswordModal\n visibility={modalVisibility}\n onClose={() => setModalVisibility(false)}\n />\n </>\n );\n};\n\nconst SignOutButton: React.FC = () => {\n const { t } = useTranslation('profile');\n\n const [commit, loading] = useMutation<ProfileDrawerSignOutMutation>(graphql`\n mutation ProfileDrawerSignOutMutation {\n signOut {\n ok\n }\n }\n `);\n\n const handler = useCallback(() => {\n commit({\n variables: {},\n onError: (error) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n message.error((error as any).source?.errors?.[0]?.message);\n },\n onCompleted: () => {\n window.location.href = '/auth/';\n },\n });\n }, [commit]);\n\n return (\n <ProfileButton danger loading={loading} onClick={handler}>\n {t('profile:signOut')}\n </ProfileButton>\n );\n};\n\nconst ProfileDrawer: React.FC<ProfileDrawerProps> = ({\n actions,\n children,\n ...rest\n}) => {\n const { email, firstName, lastName, avatar } = useProfile();\n\n const fullName = useMemo(\n () => [firstName, lastName].filter((i) => i).join(' '),\n [firstName, lastName]\n );\n\n return (\n <StyledDrawer placement='right' width='15em' {...rest}>\n <AvatarContainer>\n <UserAvatar size='10em' />\n <UserContent>\n {fullName && <FullName>{fullName}</FullName>}\n <Email>{email}</Email>\n </UserContent>\n </AvatarContainer>\n\n <ActionsContainer>\n {avatar && <DeleteAvatarButton />}\n\n <UpdateAvatarButton hasAvatar={!!avatar} />\n <UpdateNameButton hasName={!!fullName} />\n <ChangePasswordButton />\n\n {actions}\n\n <SignOutButton />\n\n {children}\n </ActionsContainer>\n\n <Footer>\n <ThemeSwitcher />\n </Footer>\n </StyledDrawer>\n );\n};\n\nexport default ProfileDrawer;\n"],"file":"ProfileDrawer.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileDrawer.tsx"],"names":["React","lazy","Suspense","Drawer","styled","MainLoader","LazyProfileDrawerContent","StyledDrawer","ProfileDrawer","actions","children","rest"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,QAAtB,QAAsC,OAAtC;AACA,SAASC,MAAT,QAAoC,iBAApC;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AAEA,OAAOC,UAAP,MAAuB,sBAAvB;AAEA,MAAMC,wBAAwB,gBAAGL,IAAI,CAAC,MAAM,OAAO,wBAAP,CAAP,CAArC;AAIA,MAAMM,YAAY,GAAGH,MAAM,CAACD,MAAD,CAAS;AACpC;AACA;AACA;AACA,CAJA;;AAMA,MAAMK,aAA2C,GAAG,CAAC;AACnDC,EAAAA,OADmD;AAEnDC,EAAAA,QAFmD;AAGnD,KAAGC;AAHgD,CAAD,kBAKlD,oBAAC,YAAD;AAAc,EAAA,SAAS,EAAC,OAAxB;AAAgC,EAAA,KAAK,EAAC;AAAtC,GAAiDA,IAAjD,gBACE,oBAAC,QAAD;AAAU,EAAA,QAAQ,eAAE,oBAAC,UAAD;AAApB,gBACE,oBAAC,wBAAD;AAA0B,EAAA,OAAO,EAAEF;AAAnC,GACGC,QADH,CADF,CADF,CALF;;AAcA,eAAeF,aAAf","sourcesContent":["import React, { lazy, Suspense } from 'react';\nimport { Drawer, DrawerProps } from '@os-design/core';\nimport styled from '@emotion/styled';\nimport { ProfileDrawerContentProps } from './ProfileDrawerContent';\nimport MainLoader from '../shared/MainLoader';\n\nconst LazyProfileDrawerContent = lazy(() => import('./ProfileDrawerContent'));\n\nexport type ProfileDrawerProps = ProfileDrawerContentProps & DrawerProps;\n\nconst StyledDrawer = styled(Drawer)`\n display: flex;\n flex-direction: column;\n padding: 2em 1em;\n`;\n\nconst ProfileDrawer: React.FC<ProfileDrawerProps> = ({\n actions,\n children,\n ...rest\n}) => (\n <StyledDrawer placement='right' width='15em' {...rest}>\n <Suspense fallback={<MainLoader />}>\n <LazyProfileDrawerContent actions={actions}>\n {children}\n </LazyProfileDrawerContent>\n </Suspense>\n </StyledDrawer>\n);\n\nexport default ProfileDrawer;\n"],"file":"ProfileDrawer.js"}
|