tycho-components 0.45.9 → 0.45.11

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.
@@ -5,6 +5,7 @@ import { BaseTexts } from "./localization/BaseTexts";
5
5
  import { CommentsTexts } from "./localization/CommentsTexts";
6
6
  import { CommonTexts } from "./localization/CommonTexts";
7
7
  import { ConsentTexts } from "./localization/ConsentTexts";
8
+ import { CorpusOwnerTexts } from "./localization/CorpusOwnerTexts";
8
9
  import { HeaderAppTexts } from "./localization/HeaderAppTexts";
9
10
  import { HeaderTexts } from "./localization/HeaderTexts";
10
11
  import { HelpTexts } from "./localization/HelpTexts";
@@ -33,6 +34,7 @@ const CORE_NAMESPACES = {
33
34
  const FEATURE_NAMESPACES = {
34
35
  comments: CommentsTexts,
35
36
  'conllu-graph': ConlluGraphTexts,
37
+ 'corpus-owner': CorpusOwnerTexts,
36
38
  tree: TreeTexts,
37
39
  sentence: SentenceTexts,
38
40
  history: HistoryTexts,
@@ -0,0 +1,17 @@
1
+ export declare const CorpusOwnerTexts: {
2
+ en: {
3
+ 'label.owner': string;
4
+ 'button.changeOwner': string;
5
+ 'select.noOptions': string;
6
+ };
7
+ 'pt-BR': {
8
+ 'label.owner': string;
9
+ 'button.changeOwner': string;
10
+ 'select.noOptions': string;
11
+ };
12
+ it: {
13
+ 'label.owner': string;
14
+ 'button.changeOwner': string;
15
+ 'select.noOptions': string;
16
+ };
17
+ };
@@ -0,0 +1,17 @@
1
+ export const CorpusOwnerTexts = {
2
+ en: {
3
+ 'label.owner': 'Owner',
4
+ 'button.changeOwner': 'Change owner',
5
+ 'select.noOptions': 'No users found',
6
+ },
7
+ 'pt-BR': {
8
+ 'label.owner': 'Proprietário',
9
+ 'button.changeOwner': 'Alterar proprietário',
10
+ 'select.noOptions': 'Nenhum usuário encontrado',
11
+ },
12
+ it: {
13
+ 'label.owner': 'Proprietario',
14
+ 'button.changeOwner': 'Cambia proprietario',
15
+ 'select.noOptions': 'Nessun utente trovato',
16
+ },
17
+ };
@@ -16,6 +16,7 @@ export type UserAccessResponse = {
16
16
  status: AccessStatus;
17
17
  role: AccessRole;
18
18
  plan?: string | null;
19
+ lastLogin?: number | null;
19
20
  corpora: AccessResponse[];
20
21
  parsers: AccessResponse[];
21
22
  lexicons: AccessResponse[];
@@ -8,7 +8,7 @@ import { useMessageUtils } from '../../configs/useMessageUtils';
8
8
  import AccessControlService from '../AccessControl/AccessControlService';
9
9
  import './style.scss';
10
10
  export default function CorpusOwner({ ownerName, onUpdateOwner, onOwnerUpdated, }) {
11
- const { t } = useTranslation(['information', 'configuration', 'message']);
11
+ const { t } = useTranslation(['corpus-owner', 'common', 'message']);
12
12
  const { dispatchMessage } = useMessageUtils();
13
13
  const { isSuper } = useLoggedUtils();
14
14
  const [change, setChange] = useState(false);
@@ -25,6 +25,10 @@ export default function CorpusOwner({ ownerName, onUpdateOwner, onOwnerUpdated,
25
25
  createdForm.reset({ user: null });
26
26
  });
27
27
  };
28
+ const handleCancel = () => {
29
+ setChange(false);
30
+ createdForm.reset({ user: null });
31
+ };
28
32
  const filterUsers = async (value) => {
29
33
  if (value.length < 2)
30
34
  return [];
@@ -38,5 +42,5 @@ export default function CorpusOwner({ ownerName, onUpdateOwner, onOwnerUpdated,
38
42
  }
39
43
  return options;
40
44
  };
41
- return (_jsxs("div", { className: "owner-container", children: [_jsx("div", { className: "title", children: t('document.field.owner.name') }), isSuper() && change && (_jsx(AsyncSelectField, { attr: "user", createdForm: createdForm, loadOptions: filterUsers, onChange: handleSelectUser, noOptionsText: t('message:generic.option.notfound') })), _jsxs("div", { className: "group", children: [!change && _jsx("span", { children: ownerName }), isSuper() && !change && (_jsx(Button, { text: t('document.button.changeOwner'), size: "small", onClick: () => setChange(true) }))] })] }));
45
+ return (_jsxs("div", { className: "owner-container", children: [_jsx("div", { className: "title", children: t('label.owner') }), isSuper() && change && (_jsxs("div", { className: "edit-row", children: [_jsx(AsyncSelectField, { attr: "user", createdForm: createdForm, loadOptions: filterUsers, onChange: handleSelectUser, noOptionsText: t('select.noOptions') }), _jsx(Button, { text: t('common:button.cancel'), size: "small", mode: "outlined", onClick: handleCancel })] })), _jsxs("div", { className: "group", children: [!change && _jsx("span", { children: ownerName }), isSuper() && !change && (_jsx(Button, { text: t('button.changeOwner'), size: "small", onClick: () => setChange(true) }))] })] }));
42
46
  }
@@ -7,6 +7,17 @@
7
7
  @include body-medium-2;
8
8
  }
9
9
 
10
+ > .edit-row {
11
+ display: flex;
12
+ align-items: flex-start;
13
+ gap: var(--spacing-200);
14
+
15
+ > .ds-button {
16
+ flex-shrink: 0;
17
+ margin-top: var(--spacing-050);
18
+ }
19
+ }
20
+
10
21
  > .group {
11
22
  display: flex;
12
23
  align-items: center;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.45.9",
4
+ "version": "0.45.11",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -90,7 +90,7 @@
90
90
  "react-i18next": "^13.0.2",
91
91
  "react-router-dom": "^6.14.2",
92
92
  "react-toastify": "^9.1.3",
93
- "tycho-storybook": "0.12.6",
93
+ "tycho-storybook": "0.12.7",
94
94
  "wavesurfer-react": "^2.2.2",
95
95
  "wavesurfer.js": "^6.6.3"
96
96
  },
@@ -120,7 +120,7 @@
120
120
  "react-toastify": "^9.1.3",
121
121
  "sass-embedded": "^1.97.2",
122
122
  "storybook": "^10.1.11",
123
- "tycho-storybook": "^0.12.6",
123
+ "tycho-storybook": "^0.12.7",
124
124
  "typescript": "^5.7.3",
125
125
  "vite": "^7.0.0",
126
126
  "vitest": "^3.2.6",