mirror of
https://github.com/logto-io/logto.git
synced 2025-01-20 21:32:31 -05:00
refactor(console,ui): import noop
from silverhand/essentials
(#2601)
This commit is contained in:
parent
dac1f5cb49
commit
29f2ce45d4
3 changed files with 3 additions and 12 deletions
|
@ -1,10 +1,7 @@
|
||||||
import type { LanguageTag } from '@logto/language-kit';
|
import type { LanguageTag } from '@logto/language-kit';
|
||||||
|
import { noop } from '@silverhand/essentials';
|
||||||
import { createContext, useMemo, useState } from 'react';
|
import { createContext, useMemo, useState } from 'react';
|
||||||
|
|
||||||
const noop = () => {
|
|
||||||
throw new Error('Context provider not found');
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ConfirmationState = 'none' | 'try-close' | 'try-switch-language' | 'try-add-language';
|
export type ConfirmationState = 'none' | 'try-close' | 'try-switch-language' | 'try-add-language';
|
||||||
|
|
||||||
export type Context = {
|
export type Context = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { Nullable } from '@silverhand/essentials';
|
import type { Nullable } from '@silverhand/essentials';
|
||||||
|
import { noop } from '@silverhand/essentials';
|
||||||
import { useState, useRef, useMemo, createContext, useCallback } from 'react';
|
import { useState, useRef, useMemo, createContext, useCallback } from 'react';
|
||||||
|
|
||||||
import type { ModalProps } from '@/components/ConfirmModal';
|
import type { ModalProps } from '@/components/ConfirmModal';
|
||||||
|
@ -25,10 +26,6 @@ type ConfirmModalContextType = {
|
||||||
cancel: (data?: unknown) => void;
|
cancel: (data?: unknown) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const noop = () => {
|
|
||||||
throw new Error('Context provider not found');
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ConfirmModalContext = createContext<ConfirmModalContextType>({
|
export const ConfirmModalContext = createContext<ConfirmModalContextType>({
|
||||||
show: async () => [true],
|
show: async () => [true],
|
||||||
confirm: noop,
|
confirm: noop,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { noop } from '@silverhand/essentials';
|
||||||
import { useState, useMemo, createContext } from 'react';
|
import { useState, useMemo, createContext } from 'react';
|
||||||
import { isMobile } from 'react-device-detect';
|
import { isMobile } from 'react-device-detect';
|
||||||
|
|
||||||
|
@ -18,10 +19,6 @@ export type Context = {
|
||||||
setExperienceSettings: React.Dispatch<React.SetStateAction<SignInExperienceResponse | undefined>>;
|
setExperienceSettings: React.Dispatch<React.SetStateAction<SignInExperienceResponse | undefined>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const noop = () => {
|
|
||||||
throw new Error('Context provider not found');
|
|
||||||
};
|
|
||||||
|
|
||||||
export const PageContext = createContext<Context>({
|
export const PageContext = createContext<Context>({
|
||||||
toast: '',
|
toast: '',
|
||||||
theme: 'light',
|
theme: 'light',
|
||||||
|
|
Loading…
Add table
Reference in a new issue