mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
chore(console): code cleanup (#4390)
This commit is contained in:
parent
dcff078d68
commit
8459cb55ad
7 changed files with 8 additions and 12 deletions
|
@ -1,6 +1,5 @@
|
|||
import type { FormEventHandler, KeyboardEventHandler } from 'react';
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import SearchIcon from '@/assets/icons/search.svg';
|
||||
|
||||
|
@ -27,8 +26,6 @@ function Search({
|
|||
onClearSearch,
|
||||
}: Props) {
|
||||
const [inputValue, setInputValue] = useState<string>(defaultValue);
|
||||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||
|
||||
const handleSearchKeyPress: KeyboardEventHandler<HTMLInputElement> = (event) => {
|
||||
if (event.key === 'Enter' && inputValue) {
|
||||
onSearch?.(inputValue);
|
||||
|
|
|
@ -3,6 +3,7 @@ import { useLogto } from '@logto/react';
|
|||
import { getManagementApiResourceIndicator, type RequestErrorBody } from '@logto/schemas';
|
||||
import { conditionalArray } from '@silverhand/essentials';
|
||||
import ky from 'ky';
|
||||
import { type KyInstance } from 'node_modules/ky/distribution/types/ky';
|
||||
import { useCallback, useContext, useMemo } from 'react';
|
||||
import { toast } from 'react-hot-toast';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
@ -29,7 +30,11 @@ export type StaticApiProps = {
|
|||
resourceIndicator: string;
|
||||
};
|
||||
|
||||
export const useStaticApi = ({ prefixUrl, hideErrorToast, resourceIndicator }: StaticApiProps) => {
|
||||
export const useStaticApi = ({
|
||||
prefixUrl,
|
||||
hideErrorToast,
|
||||
resourceIndicator,
|
||||
}: StaticApiProps): KyInstance => {
|
||||
const { isAuthenticated, getAccessToken, signOut } = useLogto();
|
||||
const { t, i18n } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||
const { show } = useConfirmModal();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import type { AdminConsoleKey } from '@logto/phrases';
|
||||
import classNames from 'classnames';
|
||||
import type { ReactNode } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import type { PreviewPlatform } from '@/components/SignInExperiencePreview/types';
|
||||
import DynamicT from '@/ds-components/DynamicT';
|
||||
|
@ -18,8 +17,6 @@ type Props = {
|
|||
};
|
||||
|
||||
function PlatformTab({ isSelected, icon, title, tab, onClick }: Props) {
|
||||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||
|
||||
return (
|
||||
<div
|
||||
role="tab"
|
||||
|
|
|
@ -51,7 +51,6 @@ const mapToUriOriginFormatArrays = (value?: string[]) =>
|
|||
|
||||
function ApplicationDetails() {
|
||||
const { id, guideId, tab } = useParams();
|
||||
console.log(tab);
|
||||
const { navigate, match } = useTenantPathname();
|
||||
const isGuideView = id && guideId && match(`/applications/${id}/guide/${guideId}`);
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import type { AdminConsoleKey } from '@logto/phrases';
|
||||
import { conditionalString } from '@silverhand/essentials';
|
||||
import classNames from 'classnames';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import ArrowDown from '@/assets/icons/arrow-down.svg';
|
||||
import ArrowUp from '@/assets/icons/arrow-up.svg';
|
||||
|
@ -24,8 +23,6 @@ type Props = {
|
|||
};
|
||||
|
||||
function Block({ variant = 'default', count, delta, title, tip }: Props) {
|
||||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||
|
||||
const deltaLabel = delta !== undefined && `${conditionalString(delta >= 0 && '+')}${delta}`;
|
||||
|
||||
return (
|
||||
|
|
|
@ -125,6 +125,7 @@ function LinkAccountSection({ user, connectors, onUpdate }: Props) {
|
|||
t,
|
||||
onUpdate,
|
||||
getSocialAuthorizationUri,
|
||||
getUrl,
|
||||
]);
|
||||
|
||||
return (
|
||||
|
|
|
@ -48,7 +48,7 @@ function CustomHeaderField() {
|
|||
};
|
||||
|
||||
const revalidate = () => {
|
||||
for (const [index, _] of fields.entries()) {
|
||||
for (const [index] of fields.entries()) {
|
||||
void trigger(`headers.${index}.key`);
|
||||
if (submitCount > 0) {
|
||||
void trigger(`headers.${index}.value`);
|
||||
|
|
Loading…
Reference in a new issue