0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

chore(core): make the i18n optional for connector metadata (#1711)

* chore(core): make the i18n optional for connector metadata

make i18n optional for connector metadata

* fix(console): update type assertion

update type assertion

* chore(console): insert type instead

insert type instead
This commit is contained in:
simeng-li 2022-08-01 17:58:34 +08:00 committed by GitHub
parent 7aaac5b0d9
commit 84f3b7f05e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 13 deletions

View file

@ -1,6 +1,7 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"isolatedModules": false
"isolatedModules": false,
"allowJs": true
}
}

View file

@ -1,6 +1,7 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"isolatedModules": false
"isolatedModules": false,
"allowJs": true
}
}

View file

@ -1,4 +1,4 @@
import { Language } from '@logto/phrases';
import type { Language } from '@logto/phrases';
import { Nullable } from '@silverhand/essentials';
import { z } from 'zod';
@ -30,15 +30,19 @@ export enum ConnectorPlatform {
Web = 'Web',
}
type i18nPhrases = { [Language.English]: string } & {
[key in Exclude<Language, Language.English>]?: string;
};
export interface ConnectorMetadata {
id: string;
target: string;
type: ConnectorType;
platform: Nullable<ConnectorPlatform>;
name: Record<Language, string>;
name: i18nPhrases;
logo: string;
logoDark: Nullable<string>;
description: Record<Language, string>;
description: i18nPhrases;
readme: string;
configTemplate: string;
}

View file

@ -1,5 +1,4 @@
import { Language } from '@logto/phrases';
import { Identities } from '@logto/schemas';
import type { Identities, ConnectorDto } from '@logto/schemas';
import { Optional } from '@silverhand/essentials';
import { useMemo, useState } from 'react';
import { Trans, useTranslation } from 'react-i18next';
@ -20,12 +19,7 @@ type Props = {
onDelete?: (connectorId: string) => void;
};
type DisplayConnector = {
target: string;
userId?: string;
logo: string;
name: Record<Language, string>;
};
type DisplayConnector = Pick<ConnectorDto, 'target' | 'logo' | 'name'> & { userId?: string };
const UserConnectors = ({ userId, connectors, onDelete }: Props) => {
const api = useApi();