diff --git a/components/Dialect/index.tsx b/components/Dialect/index.tsx new file mode 100644 index 0000000000..b1f0bc4e8f --- /dev/null +++ b/components/Dialect/index.tsx @@ -0,0 +1,17 @@ +'use client' + +import { web3 } from '@coral-xyz/anchor' +import { DialectSolanaSdk } from '@dialectlabs/react-sdk-blockchain-solana' +import { NotificationsButton } from '@dialectlabs/react-ui' + +const REALMS_PUBLIC_KEY = new web3.PublicKey( + 'BUxZD6aECR5B5MopyvvYqJxwSKDBhx2jSSo1U32en6mj' +) + +export default function DialectNotifications() { + return ( + + + + ) +} diff --git a/components/DialectNotificationsModal/index.tsx b/components/DialectNotificationsModal/index.tsx deleted file mode 100644 index d972c59755..0000000000 --- a/components/DialectNotificationsModal/index.tsx +++ /dev/null @@ -1,152 +0,0 @@ -import { - ConfigProps, - defaultVariables, - DialectThemeProvider, - DialectUiManagementProvider, - IncomingThemeVariables, - Notifications, -} from '@dialectlabs/react-ui' -import { - DialectSolanaSdk, - DialectSolanaWalletAdapter, - SolanaConfigProps, -} from '@dialectlabs/react-sdk-blockchain-solana' -import { SignerWalletAdapter } from '@solana/wallet-adapter-base' -import { useTheme } from 'next-themes' -import { useEffect, useMemo, useState } from 'react' -import { web3 } from '@coral-xyz/anchor' -import useWalletOnePointOh from '@hooks/useWalletOnePointOh' - -const REALMS_PUBLIC_KEY = new web3.PublicKey( - 'BUxZD6aECR5B5MopyvvYqJxwSKDBhx2jSSo1U32en6mj' -) - -const themeVariables: IncomingThemeVariables = { - dark: { - bellButton: - '!bg-bkg-2 !shadow-none text-fgd-1 h-10 rounded-full w-10 hover:bg-bkg-3', - iconButton: `${defaultVariables.dark.iconButton} hover:opacity-100`, - buttonLoading: `${defaultVariables.dark.buttonLoading} rounded-full min-h-[40px]`, - adornmentButton: `${defaultVariables.dark.adornmentButton} !text-bkg-1 bg-primary-light border-primary-light font-bold rounded-full hover:bg-fgd-1 hover:opacity-100`, - colors: { - ...defaultVariables.dark.colors, - bg: 'bg-bkg-1', - toggleBackgroundActive: 'bg-primary-light', - }, - textStyles: { - input: 'text-primary-1 bg-bkg-1 border-none hover:border-none', - }, - outlinedInput: `${defaultVariables.dark.outlinedInput} focus-within:border-primary-light`, - disabledButton: `${defaultVariables.dark.disabledButton} border-primary-light font-bold rounded-full border-fgd-3 text-fgd-3 cursor-not-allowed`, - modal: `${defaultVariables.dark.modal} bg-bkg-1 sm:border sm:border-fgd-4 shadow-md sm:rounded-md`, - modalWrapper: `${defaultVariables.dark.modalWrapper} sm:top-14 rounded-md`, - secondaryDangerButton: `${defaultVariables.dark.secondaryDangerButton} rounded-full`, - }, - light: { - bellButton: - '!bg-bkg-2 !shadow-none text-fgd-1 h-10 rounded-full w-10 hover:bg-bkg-3', - iconButton: `${defaultVariables.light.iconButton} hover:opacity-100`, - buttonLoading: `${defaultVariables.dark.buttonLoading} rounded-full min-h-[40px]`, - adornmentButton: `${defaultVariables.light.adornmentButton} bg-primary-light border-primary-light font-bold rounded-full hover:bg-fgd-1 hover:opacity-100`, - colors: { - ...defaultVariables.light.colors, - toggleBackgroundActive: 'bg-primary-light', - }, - textStyles: { - input: `${defaultVariables.light.textStyles.input} text-fgd-1 placeholder:text-fgd-3`, - body: `${defaultVariables.light.textStyles.body} text-fgd-1`, - }, - outlinedInput: `${defaultVariables.light.outlinedInput} focus-within:border-primary-light`, - modal: `${defaultVariables.light.modal} sm:border sm:rounded-md sm:border-fgd-4 sm:shadow-md`, - modalWrapper: `${defaultVariables.dark.modalWrapper} sm:top-14`, - secondaryDangerButton: `${defaultVariables.light.secondaryDangerButton} rounded-full`, - }, -} - -const solanaWalletToDialectWallet = ( - wallet?: SignerWalletAdapter -): DialectSolanaWalletAdapter | null => { - if (!wallet || !wallet.connected || wallet.connecting || !wallet.publicKey) { - return null - } - - return { - publicKey: wallet.publicKey!, - // @ts-ignore - signMessage: wallet?.signMessage - ? // @ts-ignore - (msg) => wallet.signMessage(msg) - : undefined, - - signTransaction: wallet.signTransaction as any, - signAllTransactions: wallet.signAllTransactions as any, - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - diffieHellman: wallet.wallet?.adapter?._wallet?.diffieHellman - ? async (pubKey: any) => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - return wallet.wallet?.adapter?._wallet?.diffieHellman(pubKey) - } - : undefined, - } -} - -interface DialectNotificationsModalProps { - onBackClick?: () => void - onModalClose: () => void -} - -export default function DialectNotificationsModal( - props: DialectNotificationsModalProps -) { - const { theme } = useTheme() - const wallet = useWalletOnePointOh() - - const [ - dialectSolanaWalletAdapter, - setDialectSolanaWalletAdapter, - ] = useState(() => - solanaWalletToDialectWallet(wallet) - ) - - useEffect(() => { - setDialectSolanaWalletAdapter(solanaWalletToDialectWallet(wallet)) - }, [wallet]) - - const dialectConfig = useMemo( - (): ConfigProps => ({ - environment: 'production', - dialectCloud: { - tokenStore: 'local-storage', - }, - }), - [] - ) - - const solanaConfig: SolanaConfigProps = useMemo( - () => ({ - wallet: dialectSolanaWalletAdapter, - }), - [dialectSolanaWalletAdapter] - ) - - return ( - - - - - - - - ) -} diff --git a/components/NavBar.tsx b/components/NavBar.tsx index f0802479f3..ab3a147c9d 100644 --- a/components/NavBar.tsx +++ b/components/NavBar.tsx @@ -1,9 +1,9 @@ import useQueryContext from '@hooks/useQueryContext' import Link from 'next/link' import dynamic from 'next/dynamic' -import NotificationsSwitch from './NotificationsSwitch' import ThemeSwitch from './ThemeSwitch' import { ExternalLinkIcon } from '@heroicons/react/outline' +import DialectNotifications from './Dialect' const ConnectWalletButtonDynamic = dynamic( async () => await import('./ConnectWalletButton'), @@ -38,7 +38,7 @@ const NavBar = () => { - + diff --git a/components/NotifiIcon.tsx b/components/NotifiIcon.tsx deleted file mode 100644 index 6883c5f639..0000000000 --- a/components/NotifiIcon.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { useTheme } from 'next-themes' -import NotifiIconDark from './NotificationsSwitch/NotifiIconDark' -import NotifiIconLight from './NotificationsSwitch/NotifiIconLight' - -const NotifiIcon = ({ height = '30' }) => { - const { theme } = useTheme() - return theme === 'Dark' ? ( - - ) : ( - - ) -} - -export default NotifiIcon diff --git a/components/NotificationsCard/NotifiFullLogo.tsx b/components/NotificationsCard/NotifiFullLogo.tsx deleted file mode 100644 index b97ddc2c9b..0000000000 --- a/components/NotificationsCard/NotifiFullLogo.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { useTheme } from 'next-themes' -import NotifiLogoFullDark from './NotifiLogoFullDark' -import NotifiLogoFullLight from './NotifiLogoFullLight ' - -const NotifiFullLogo = ({ height = '23', width = '340' }) => { - const { theme } = useTheme() - return theme === 'Dark' ? ( - - ) : ( - - ) -} - -export default NotifiFullLogo diff --git a/components/NotificationsCard/NotifiLogoFullDark.tsx b/components/NotificationsCard/NotifiLogoFullDark.tsx deleted file mode 100644 index 0022f6eabd..0000000000 --- a/components/NotificationsCard/NotifiLogoFullDark.tsx +++ /dev/null @@ -1,63 +0,0 @@ -const NotifiIconDark = ({ height = '40', width = '340' }) => { - return ( - - - - - - - - - - - - - - - - - ) -} - -export default NotifiIconDark diff --git a/components/NotificationsCard/NotifiLogoFullLight .tsx b/components/NotificationsCard/NotifiLogoFullLight .tsx deleted file mode 100644 index 93066a6eeb..0000000000 --- a/components/NotificationsCard/NotifiLogoFullLight .tsx +++ /dev/null @@ -1,63 +0,0 @@ -const NotifiIconDark = ({ height = '50', width = '340' }) => { - return ( - - - - - - - - - - - - - - - - - ) -} - -export default NotifiIconDark diff --git a/components/NotificationsCard/NotifiLogoLightLong.svg b/components/NotificationsCard/NotifiLogoLightLong.svg deleted file mode 100644 index e5edd54c09..0000000000 --- a/components/NotificationsCard/NotifiLogoLightLong.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/components/NotificationsCard/NotifiPreviewCard.tsx b/components/NotificationsCard/NotifiPreviewCard.tsx deleted file mode 100644 index aca28419b9..0000000000 --- a/components/NotificationsCard/NotifiPreviewCard.tsx +++ /dev/null @@ -1,203 +0,0 @@ -import Switch from './NotifiSwitch' -import { XIcon } from '@heroicons/react/solid' -import { Source, useNotifiClient } from '@notifi-network/notifi-react-hooks' -import React, { - FunctionComponent, - useCallback, - useEffect, - useMemo, - useState, -} from 'react' - -import NotifiFullLogo from './NotifiFullLogo' -type NotifiClientReturnType = ReturnType - -type NotifiPreviewCardProps = { - onClick: () => void - onClose: () => void - telegramEnabled: boolean - email: string - phoneNumber: string - telegram: string - handleDelete: (source: Source) => Promise -} & Pick - -const NotifiPreviewCard: FunctionComponent = ({ - createAlert, - data, - email, - handleDelete, - onClose, - onClick, - phoneNumber, - telegram, - telegramEnabled, - isAuthenticated, -}) => { - const alerts = data?.alerts - const sources = data?.sources - const [isLoading, setLoading] = useState(false) - - const handleEdit = useCallback(() => { - onClick() - }, [onClick]) - - const handleUnsubscribe = useCallback( - async (source: Source) => { - if (isLoading) { - return - } - handleDelete(source) - }, - [handleDelete, isLoading] - ) - - useEffect(() => { - if (!isAuthenticated) { - onClick() - } - // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO please fix, it can cause difficult bugs. You might wanna check out https://bobbyhadz.com/blog/react-hooks-exhaustive-deps for info. -@asktree - }, [isAuthenticated]) - - const handleSubscribe = useCallback( - async (source: Source) => { - if (isLoading) { - return - } - - if (!source) { - throw new Error('No source provided') - } - const filterId = source.applicableFilters[0].id - - if (!filterId) { - throw new Error('No filter id found') - } - try { - setLoading(true) - const alertResult = await createAlert({ - emailAddress: email === '' ? null : email, - filterId: filterId ?? '', - name: `${source.name} notification`, - phoneNumber: phoneNumber === '' ? null : phoneNumber, - sourceId: source.id ?? '', - telegramId: telegram === '' ? null : telegram, - }) - - if (alertResult) { - if (alertResult.targetGroup?.telegramTargets?.length > 0) { - const target = alertResult.targetGroup?.telegramTargets[0] - if (target && target.isConfirmed === false) { - if (target.confirmationUrl) { - window.open(target.confirmationUrl) - } - } - } - } - setLoading(false) - } catch (e) { - throw new Error(e) - } - }, - [createAlert, email, phoneNumber, telegram, isLoading] - ) - - const daoNotifications = useMemo( - () => (source: Source) => { - const handleClick = (source: Source) => { - isChecked ? handleUnsubscribe(source) : handleSubscribe(source) - } - const sourceId = source.id - - const isChecked = Boolean( - alerts?.some((alert) => - alert.sourceGroup.sources.some((source) => source.id === sourceId) - ) - ) - - return ( -
-
- {source.name} Notifications On -
-
- handleClick(source)} /> -
-
- ) - }, - // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO please fix, it can cause difficult bugs. You might wanna check out https://bobbyhadz.com/blog/react-hooks-exhaustive-deps for info. -@asktree - [alerts, handleDelete, handleSubscribe] - ) - - const notificationsToggle = useMemo( - () => - sources - ?.map((source) => { - if (source.type === 'DIRECT_PUSH') { - return - } - return daoNotifications(source) - }) - ?.filter((source) => source), - [daoNotifications, sources] - ) - - return ( -
-
-
-

Notifications

- -
- {data && data?.sources?.length > 0 ? ( -
-

{email}

-

{phoneNumber}

- {telegramEnabled &&

{telegram}

} -
- Edit Information -
-
- ) : ( -
-

No governance memberships found

-
- )} -
- {notificationsToggle && notificationsToggle.length >= 1 ? ( -
- {notificationsToggle} -
- ) : null} -
-
-

Powered by

- - - -
- -
-
- ) -} - -export default NotifiPreviewCard diff --git a/components/NotificationsCard/NotifiSwitch.tsx b/components/NotificationsCard/NotifiSwitch.tsx deleted file mode 100644 index 1ad9adf671..0000000000 --- a/components/NotificationsCard/NotifiSwitch.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import { FunctionComponent } from 'react' - -interface SwitchProps { - checked: boolean - onChange: (x: boolean) => void -} - -const Switch: FunctionComponent = ({ - checked = false, - onChange, -}) => { - const handleClick = () => { - onChange(!checked) - } - - return ( -
- -
- ) -} - -export default Switch diff --git a/components/NotificationsCard/NotificationCardContainer.tsx b/components/NotificationsCard/NotificationCardContainer.tsx deleted file mode 100644 index fb54b149ee..0000000000 --- a/components/NotificationsCard/NotificationCardContainer.tsx +++ /dev/null @@ -1,181 +0,0 @@ -import NotificationsCard from '@components/NotificationsCard' -import NotifiPreviewCard from '@components/NotificationsCard/NotifiPreviewCard' -import useWalletOnePointOh from '@hooks/useWalletOnePointOh' -import { EndpointTypes } from '@models/types' -import { - BlockchainEnvironment, - Source, - useNotifiClient, -} from '@notifi-network/notifi-react-hooks' -import { firstOrNull } from '@utils/helpers' -import { useRouter } from 'next/router' -import { useCallback, useEffect, useState } from 'react' - -type Props = { - onClose: () => void - onBackClick: () => void -} - -const NotificationCardContainer: React.FC = ({ - onClose, - onBackClick, -}) => { - const [showPreview, setPreview] = useState(true) - const router = useRouter() - - const { cluster } = router.query - - const endpoint = cluster ? (cluster as EndpointTypes) : 'mainnet' - const wallet = useWalletOnePointOh() - const connected = !!wallet?.connected - let env = BlockchainEnvironment.MainNetBeta - - switch (endpoint) { - case 'mainnet': - break - case 'devnet': - env = BlockchainEnvironment.DevNet - break - case 'localnet': - env = BlockchainEnvironment.LocalNet - break - } - const notifiClient = useNotifiClient({ - dappAddress: 'solanarealmsdao', - env, - walletPublicKey: wallet?.publicKey?.toString() ?? '', - }) - - const { data, getConfiguration, deleteAlert, isInitialized } = notifiClient - - const [email, setEmail] = useState('') - const [phoneNumber, setPhone] = useState('') - const [telegram, setTelegram] = useState('') - const [telegramEnabled, setTelegramEnabled] = useState(false) - - useEffect(() => { - const targetGroup = firstOrNull(data?.targetGroups) - if (targetGroup) { - setEmail(firstOrNull(targetGroup?.emailTargets)?.emailAddress ?? '') - setPhone(firstOrNull(targetGroup?.smsTargets)?.phoneNumber ?? '') - setTelegram(firstOrNull(targetGroup?.telegramTargets)?.telegramId ?? '') - } else { - setEmail(firstOrNull(data?.emailTargets)?.emailAddress ?? '') - setPhone(firstOrNull(data?.smsTargets)?.phoneNumber ?? '') - setTelegram(firstOrNull(data?.telegramTargets)?.telegramId ?? '') - } - }, [data]) - - const updateTelegramSupported = useCallback(async () => { - const { supportedTargetTypes } = await getConfiguration() - const telegram = supportedTargetTypes.find( - (targetType) => targetType === 'TELEGRAM' - ) - setTelegramEnabled(telegram !== undefined) - }, [getConfiguration, setTelegramEnabled]) - - useEffect(() => { - updateTelegramSupported().catch((e) => { - console.error('Failed to get supported type information: ', e) - }) - }, [updateTelegramSupported]) - - useEffect(() => { - if (connected && isInitialized) { - const targetGroup = firstOrNull(data?.targetGroups) - - if (targetGroup) { - setEmail(firstOrNull(targetGroup?.emailTargets)?.emailAddress ?? '') - setPhone(firstOrNull(targetGroup?.smsTargets)?.phoneNumber ?? '') - setTelegram(firstOrNull(targetGroup?.telegramTargets)?.telegramId ?? '') - } else { - setEmail(firstOrNull(data?.emailTargets)?.emailAddress ?? '') - setPhone(firstOrNull(data?.smsTargets)?.phoneNumber ?? '') - setTelegram(firstOrNull(data?.telegramTargets)?.telegramId ?? '') - } - } - - if (data && data?.sources.length > 0) { - if (email || phoneNumber || telegram) { - setPreview(true) - } - } - }, [connected, data, email, setPreview, isInitialized, phoneNumber, telegram]) - - const handleDelete = useCallback( - async (source: Source) => { - try { - if (data?.alerts) { - const sourceId = source.id - const alertToDelete = data.alerts?.find((alert) => - alert.sourceGroup.sources.find((source) => source.id === sourceId) - ) - - alertToDelete?.id && - (await deleteAlert({ - alertId: alertToDelete.id, - keepSourceGroup: true, - keepTargetGroup: true, - })) - } - } catch (e) { - throw new Error(e) - } - }, - [data?.alerts, deleteAlert] - ) - - return ( -
-
-
- {!isInitialized && ( -
-
-
-
-
-
-
-
-
-
-
-
-
-
- )} - {showPreview && isInitialized && ( - setPreview(false)} - /> - )} - {!showPreview && isInitialized && ( - - )} -
-
-
- ) -} - -export default NotificationCardContainer diff --git a/components/NotificationsCard/PhoneInput.tsx b/components/NotificationsCard/PhoneInput.tsx deleted file mode 100644 index c9d79a1dc4..0000000000 --- a/components/NotificationsCard/PhoneInput.tsx +++ /dev/null @@ -1,151 +0,0 @@ -import Input from '@components/inputs/Input' -import { Listbox, Transition } from '@headlessui/react' -import { ChatAltIcon, ChevronDownIcon } from '@heroicons/react/outline' -import { isValidPhoneNumber } from 'libphonenumber-js' -import { Dispatch, SetStateAction } from 'react' -import { Fragment, useCallback, useEffect, useState } from 'react' - -import { InputRow } from '.' -import { countryMap } from './data' -import { splitPhoneNumber } from './phoneUtils' - -type Props = { - handlePhone: (input: string) => void - phoneNumber: string - setErrorMessage: Dispatch> -} - -const PhoneInput = ({ handlePhone, phoneNumber, setErrorMessage }: Props) => { - const [selectedCountryCode, setCountryCode] = useState('US') - const [dialCode, setDialCode] = useState('+1') - const [baseNumber, setBaseNumber] = useState('') - - const selectCountryHandler = useCallback( - (value: string) => { - setCountryCode(value) - const dialCode = countryMap[value].dialCode - setDialCode(dialCode) - - const input = baseNumber !== '' ? dialCode + baseNumber : '' - handlePhone(input) - }, - [baseNumber, handlePhone] - ) - - const splitPhoneNumbers = useCallback( - (phoneNumber: string) => { - const { baseNumber, countryCode } = splitPhoneNumber(phoneNumber) - if (!countryCode || !baseNumber) { - setErrorMessage('Improper phone, please try again') - } - setBaseNumber(baseNumber) - setCountryCode(countryCode) - }, - [setErrorMessage] - ) - - useEffect(() => { - if (phoneNumber && isValidPhoneNumber(phoneNumber)) { - splitPhoneNumbers(phoneNumber) - } - // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO please fix, it can cause difficult bugs. You might wanna check out https://bobbyhadz.com/blog/react-hooks-exhaustive-deps for info. -@asktree - }, [phoneNumber, splitPhoneNumbers, isValidPhoneNumber]) - - const onChange = useCallback( - (event: React.ChangeEvent) => { - const onlyNumberInput = event.target.value.replace(/[^\d]/g, '') - - setBaseNumber(onlyNumberInput) - const input = onlyNumberInput !== '' ? dialCode + onlyNumberInput : '' - handlePhone(input) - }, - [dialCode, handlePhone] - ) - - const validatePhoneNumber = () => { - if (!isValidPhoneNumber(phoneNumber) && phoneNumber !== '') { - setErrorMessage('You have entered an invalid number') - } - } - - return ( - - } - label="phone" - > - setErrorMessage('')} - onBlur={validatePhoneNumber} - placeholder="XXX-XXX-XXXX" - type="tel" - value={baseNumber} - /> -
- -
- - {dialCode} - - - - - - {Object.entries(countryMap).map( - ([countryCode, countryMetadata], idx) => { - const { dialCode, flag, name } = countryMetadata - return ( - - `relative cursor-default select-none py-2 pl-2 pr-4 z-20 ${ - active - ? 'bg-gray-800 text-grey-300' - : 'text-gray-300' - }` - } - key={idx} - value={countryCode} - > - {({ selected }) => ( - <> - -
-
- {flag} - {name} -
-
{dialCode}
-
-
- - )} -
- ) - } - )} -
-
-
-
-
-
- ) -} - -export default PhoneInput diff --git a/components/NotificationsCard/data.tsx b/components/NotificationsCard/data.tsx deleted file mode 100644 index d7f90c2279..0000000000 --- a/components/NotificationsCard/data.tsx +++ /dev/null @@ -1,137 +0,0 @@ -type CountryMetadata = { - name: string - dialCode: string - flag: string -} - -type CountryMap = { - [countryCode: string]: CountryMetadata -} - -export const countryMap: CountryMap = { - US: { - dialCode: '+1', - flag: '🇺🇸', - name: 'United States', - }, - AU: { - dialCode: '+61', - flag: '🇦🇺', - name: 'Australia', - }, - AT: { - dialCode: '+43', - flag: '🇦🇹', - name: 'Austria', - }, - BE: { - dialCode: '+32', - flag: '🇧🇪', - name: 'Belgium', - }, - BR: { - dialCode: '+55', - flag: '🇧🇷', - name: 'Brazil', - }, - CA: { - dialCode: '+1', - flag: '🇨🇦', - name: 'Canada', - }, - DK: { - dialCode: '+45', - flag: '🇩🇰', - name: 'Denmark', - }, - FI: { - dialCode: '+358', - flag: '🇫🇮', - name: 'Finland', - }, - FR: { - dialCode: '+33', - flag: '🇫🇷', - name: 'France', - }, - DE: { - dialCode: '+49', - flag: '🇩🇪', - name: 'Germany', - }, - HK: { - dialCode: '+852', - flag: '🇭🇰', - name: 'Hong Kong', - }, - HU: { - dialCode: '+36', - flag: '🇭🇺', - name: 'Hungary', - }, - IS: { - dialCode: '+354', - flag: '🇮🇸', - name: 'Iceland', - }, - MY: { - dialCode: '+60', - flag: '🇲🇾', - name: 'Malaysia', - }, - NO: { - dialCode: '+47', - flag: '🇳🇴', - name: 'Norway', - }, - PH: { - dialCode: '+63', - flag: '🇵🇭', - name: 'Philippines', - }, - PL: { - dialCode: '+48', - flag: '🇵🇱', - name: 'Poland', - }, - PT: { - dialCode: '+351', - flag: '🇵🇹', - name: 'Portugal', - }, - SG: { - dialCode: '+65', - flag: '🇸🇬', - name: 'Singapore', - }, - KR: { - dialCode: '+82', - flag: '🇰🇷', - name: 'Korea, Republic of South Korea', - }, - ES: { - dialCode: '+34', - flag: '🇪🇸', - name: 'Spain', - }, - SE: { - dialCode: '+46', - flag: '🇸🇪', - name: 'Sweden', - }, - CH: { - dialCode: '+41', - flag: '🇨🇭', - name: 'Switzerland', - }, - TW: { - dialCode: '+886', - flag: '🇹🇼', - name: 'Taiwan', - }, - GB: { - dialCode: '+44', - flag: '🇬🇧', - name: 'United Kingdom', - }, -} diff --git a/components/NotificationsCard/index.tsx b/components/NotificationsCard/index.tsx deleted file mode 100644 index 7b1fdf8443..0000000000 --- a/components/NotificationsCard/index.tsx +++ /dev/null @@ -1,463 +0,0 @@ -import { - ArrowLeftIcon, - MailIcon, - PaperAirplaneIcon, -} from '@heroicons/react/solid' -import useWalletOnePointOh from '@hooks/useWalletOnePointOh' -import { - Alert, - GqlError, - MessageSigner, - useNotifiClient, -} from '@notifi-network/notifi-react-hooks' -import { firstOrNull } from '@utils/helpers' -import { isValidPhoneNumber } from 'libphonenumber-js' -import React, { - Dispatch, - FunctionComponent, - SetStateAction, - useEffect, - useState, -} from 'react' -import { useCallback } from 'react' - -import Button from '../Button' -import Input from '../inputs/Input' -import NotifiFullLogo from './NotifiFullLogo' -import PhoneInput from './PhoneInput' - -type NotifiClientReturnType = ReturnType - -type NotificationCardProps = { - onBackClick: () => void - email: string - phoneNumber: string - telegram: string - setPreview: Dispatch> - setEmail: Dispatch> - setTelegram: Dispatch> - setPhone: Dispatch> -} & Pick< - NotifiClientReturnType, - | 'createAlert' - | 'logIn' - | 'fetchData' - | 'data' - | 'isAuthenticated' - | 'updateAlert' - | 'getConfiguration' -> - -const NotificationsCard = ({ - createAlert, - data, - email, - getConfiguration, - isAuthenticated, - logIn, - onBackClick, - phoneNumber, - setEmail, - setPhone, - setPreview, - setTelegram, - telegram, - updateAlert, -}: NotificationCardProps) => { - const [isLoading, setLoading] = useState(false) - const [hasUnsavedChanges, setUnsavedChanges] = useState(false) - const [errorMessage, setErrorMessage] = useState('') - const [telegramEnabled, setTelegramEnabled] = useState(false) - const [firstTimeUser, setFirstTimeUser] = useState(false) - - const wallet = useWalletOnePointOh() - const connected = !!wallet?.connected - - const alerts = data?.alerts - const sources = data?.sources - - const [localEmail, setLocalEmail] = useState('') - const [localPhoneNumber, setLocalPhone] = useState('') - const [localTelegram, setLocalTelegram] = useState('') - - const updateTelegramSupported = useCallback(async () => { - const { supportedTargetTypes } = await getConfiguration() - const telegram = supportedTargetTypes.find((it) => it === 'TELEGRAM') - setTelegramEnabled(telegram !== undefined) - }, [getConfiguration, setTelegramEnabled]) - - useEffect(() => { - updateTelegramSupported().catch((e) => { - console.error('Failed to get supported type information: ', e) - }) - }, [updateTelegramSupported]) - - useEffect(() => { - const targetGroup = firstOrNull(data?.targetGroups) - - if (email || telegram || phoneNumber) { - setLocalEmail(email ?? '') - setLocalTelegram(telegram ?? '') - setLocalPhone(phoneNumber ?? '') - setUnsavedChanges(true) - } else if (targetGroup) { - setLocalEmail(firstOrNull(targetGroup?.emailTargets)?.emailAddress ?? '') - setLocalPhone(firstOrNull(targetGroup?.smsTargets)?.phoneNumber ?? '') - setLocalTelegram( - firstOrNull(targetGroup?.telegramTargets)?.telegramId ?? '' - ) - setUnsavedChanges(true) - } else { - setLocalEmail(firstOrNull(data?.emailTargets)?.emailAddress ?? '') - setLocalPhone(firstOrNull(data?.smsTargets)?.phoneNumber ?? '') - setLocalTelegram(firstOrNull(data?.telegramTargets)?.telegramId ?? '') - setUnsavedChanges(true) - } - }, [ - data, - data?.emailTargets, - data?.smsTargets, - data?.telegramTargets, - email, - phoneNumber, - telegram, - ]) - - const checkTelegramUnconfirmed = useCallback((alertsResponse: Alert[]) => { - const hasTelegramAlert = alertsResponse.find( - (alert) => alert.targetGroup.telegramTargets.length >= 0 - ) - const target = hasTelegramAlert?.targetGroup.telegramTargets[0] - - if (target && !target.isConfirmed) { - if (target.confirmationUrl) { - window.open(target.confirmationUrl) - } - } - - return alertsResponse.some((alertResponse) => - alertResponse.targetGroup.telegramTargets.some( - (target) => !target.isConfirmed - ) - ) - }, []) - - const handleError = (errors: { message: string }[]) => { - const error = errors.length > 0 ? errors[0] : null - if (error instanceof GqlError) { - setErrorMessage( - `${error.message}: ${error.getErrorMessages().join(', ')}` - ) - } else { - setErrorMessage(error?.message ?? 'Unknown error') - } - setLoading(false) - } - - const handleRefresh = useCallback( - async function () { - setLoading(true) - setErrorMessage('') - // user is not authenticated - if (!isAuthenticated && wallet && wallet.publicKey) { - try { - await logIn((wallet as unknown) as MessageSigner) - } catch (e) { - handleError([e]) - } - setLoading(false) - } else { - setPreview(true) - } - setLoading(false) - }, - // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO please fix, it can cause difficult bugs. You might wanna check out https://bobbyhadz.com/blog/react-hooks-exhaustive-deps for info. -@asktree - [setLoading, isAuthenticated, wallet, setErrorMessage, logIn] - ) - - const handleUpdate = async () => { - if (alerts && alerts.length >= 1) { - const results: Alert[] = [] - - for (const alert of alerts) { - const alertRes = await updateAlert({ - alertId: alert.id ?? '', - emailAddress: localEmail === '' ? null : localEmail, - phoneNumber: isValidPhoneNumber(localPhoneNumber) - ? localPhoneNumber - : null, - telegramId: localTelegram === '' ? null : localTelegram, - }) - if (alertRes) { - results.push(alertRes) - } - } - if (results) { - setEmail(results[0].targetGroup?.emailTargets[0]?.emailAddress ?? '') - setPhone(results[0].targetGroup?.smsTargets[0]?.phoneNumber ?? '') - setTelegram( - results[0].targetGroup?.telegramTargets[0]?.telegramId ?? '' - ) - setPreview(true) - } - checkTelegramUnconfirmed(results) - if (results) { - setPreview(true) - } - } else { - const results: Alert[] = [] - if (sources && sources.length >= 1) { - for (const source of sources) { - const filterId = source.applicableFilters[0].id - const alertRes = await createAlert({ - emailAddress: localEmail === '' ? null : localEmail, - filterId: filterId ?? '', - name: `${source.name} notification`, - phoneNumber: isValidPhoneNumber(localPhoneNumber) - ? localPhoneNumber - : null, - sourceId: source?.id ?? '', - telegramId: localTelegram === '' ? null : localTelegram, - }) - if (alertRes) { - results.push(alertRes) - } - } - } - if (telegram) { - checkTelegramUnconfirmed(results) - } - if (results && results.length >= 1) { - setPreview(true) - setEmail(results[0].targetGroup?.emailTargets[0]?.emailAddress ?? '') - setPhone(results[0].targetGroup?.smsTargets[0]?.phoneNumber ?? '') - setTelegram( - results[0].targetGroup?.telegramTargets[0]?.telegramId ?? '' - ) - } - } - setUnsavedChanges(false) - } - - useEffect(() => { - const handleLogIn = async () => { - await logIn((wallet as unknown) as MessageSigner) - } - - const anotherhandleUpdate = async () => { - await handleUpdate() - } - - if (firstTimeUser && sources === undefined) { - handleLogIn() - } - if (firstTimeUser && sources) { - anotherhandleUpdate() - } - // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO please fix, it can cause difficult bugs. You might wanna check out https://bobbyhadz.com/blog/react-hooks-exhaustive-deps for info. -@asktree - }, [firstTimeUser, sources]) - - const handleSave = useCallback(async () => { - setLoading(true) - if (!isAuthenticated && wallet && wallet.publicKey) { - try { - setFirstTimeUser(true) - } catch (e) { - setPreview(false) - handleError([e]) - } - } - if (connected && isAuthenticated) { - try { - setFirstTimeUser(false) - await handleUpdate() - setUnsavedChanges(false) - } catch (e) { - setPreview(false) - handleError([e]) - } - } - setLoading(false) - // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO please fix, it can cause difficult bugs. You might wanna check out https://bobbyhadz.com/blog/react-hooks-exhaustive-deps for info. -@asktree - }, [ - alerts, - checkTelegramUnconfirmed, - connected, - createAlert, - isAuthenticated, - localEmail, - localPhoneNumber, - localTelegram, - logIn, - setEmail, - setPhone, - setPreview, - setTelegram, - sources, - telegram, - updateAlert, - wallet, - ]) - - const handleEmail = (e: React.ChangeEvent) => { - setLocalEmail(e.target.value) - setUnsavedChanges(true) - } - - const handlePhone = (input: string) => { - setLocalPhone(input) - setUnsavedChanges(true) - } - - const handleTelegram = (e: React.ChangeEvent) => { - setLocalTelegram(e.target.value) - setUnsavedChanges(true) - } - - const disabled = - (isAuthenticated && !hasUnsavedChanges) || - (localEmail === '' && localTelegram === '' && localPhoneNumber === '') || - errorMessage !== '' - - return ( -
-
- - -
- {!connected ? ( - <> -
- Connect wallet to see options -
- - ) : ( - <> -
- Get notifications for proposals, voting, and results. Add your email - address, phone number, and/or Telegram. -
-
- {errorMessage.length > 0 ? ( -
{errorMessage}
- ) : ( - !isAuthenticated && ( -
- When prompted, sign the transaction. -
- ) - )} -
-
- - } - label="email" - > - - - - {telegramEnabled && ( - - } - label="Telegram" - > - - - )} -
-
-
- Already Subscribed?{' '} - - Click here to load your alert details. - -
-
-
- - - -
- - )} -
- ) -} - -interface InputRowProps { - label: string - icon: React.ReactNode -} - -export const InputRow: FunctionComponent = ({ - children, - icon, - label, -}) => { - return ( - - ) -} - -export default NotificationsCard diff --git a/components/NotificationsCard/phoneUtils.tsx b/components/NotificationsCard/phoneUtils.tsx deleted file mode 100644 index 95746b2fa5..0000000000 --- a/components/NotificationsCard/phoneUtils.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { parsePhoneNumber } from 'libphonenumber-js' - -type PhoneData = { - countryCode: string - baseNumber: string -} - -export const splitPhoneNumber = (phoneNumber: string): PhoneData => { - const { country: countryCode, nationalNumber: baseNumber } = parsePhoneNumber( - phoneNumber - ) - if (!countryCode || !baseNumber) { - throw new Error('No country or phone found') - } - - return { baseNumber, countryCode } -} diff --git a/components/NotificationsSwitch/NotifiIconDark.tsx b/components/NotificationsSwitch/NotifiIconDark.tsx deleted file mode 100644 index 7e18a4ff2e..0000000000 --- a/components/NotificationsSwitch/NotifiIconDark.tsx +++ /dev/null @@ -1,37 +0,0 @@ -const NotifiIconDark = ({ height, width }) => { - return ( - - - - - - - - - - - ) -} - -export default NotifiIconDark diff --git a/components/NotificationsSwitch/NotifiIconLight.tsx b/components/NotificationsSwitch/NotifiIconLight.tsx deleted file mode 100644 index cfdf44e1cf..0000000000 --- a/components/NotificationsSwitch/NotifiIconLight.tsx +++ /dev/null @@ -1,37 +0,0 @@ -const NotifiIconLight = ({ height, width }) => { - return ( - - - - - - - - - - - ) -} - -export default NotifiIconLight diff --git a/components/NotificationsSwitch/TelegramIcon.tsx b/components/NotificationsSwitch/TelegramIcon.tsx deleted file mode 100644 index 7661c4f62f..0000000000 --- a/components/NotificationsSwitch/TelegramIcon.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import * as React from 'react' -import { SVGProps } from 'react' - -const SvgComponent = (props: SVGProps) => ( - - - -) - -export default SvgComponent diff --git a/components/NotificationsSwitch/index.tsx b/components/NotificationsSwitch/index.tsx deleted file mode 100644 index 5835b00afd..0000000000 --- a/components/NotificationsSwitch/index.tsx +++ /dev/null @@ -1,210 +0,0 @@ -import Button from '@components/Button' -import NotifiIcon from '@components/NotifiIcon' -import { defaultVariables } from '@dialectlabs/react-ui' -import styled from '@emotion/styled' -import { Transition } from '@headlessui/react' -import { DeviceMobileIcon } from '@heroicons/react/outline' -import { BellIcon, KeyIcon, MailIcon } from '@heroicons/react/solid' - -import { useEffect, useRef, useState } from 'react' -import useNotificationStore, { ModalStates } from 'stores/useNotificationStore' - -import DialectNotificationsModal from '@components/DialectNotificationsModal' -import NotificationCardContainer from '@components/NotificationsCard/NotificationCardContainer' -import TelegramIcon from './TelegramIcon' - -function useOutsideAlerter( - ref: React.MutableRefObject, - bellRef: React.MutableRefObject, - setOpen: CallableFunction -) { - useEffect(() => { - /** - * Alert if clicked on outside of element - */ - function handleClickOutside(event: MouseEvent) { - if ( - ref.current && - !ref?.current.contains(event.target as Element) && - bellRef.current && - !bellRef?.current.contains(event.target as Element) - ) { - setOpen(false) - } - } - - // Bind the event listener - document.addEventListener('mousedown', handleClickOutside) - return () => { - // Unbind the event listener on clean up - document.removeEventListener('mousedown', handleClickOutside) - } - }, [ref, bellRef, setOpen]) -} - -const TagToIcon = { - Email: , - NotifiCenter: , - Telegram: , - Text: , - Wallet: , -} - -type ChannelType = 'Wallet' | 'Email' | 'Text' | 'Telegram' | 'Notifi Center' - -interface NotificationSolutionType { - name: string - channels: ChannelType[] - description: string - modalState: ModalStates -} - -const NotificationSolutions: NotificationSolutionType[] = [ - { - channels: ['Wallet', 'Email', 'Text', 'Telegram'], - description: `Get notifications when new proposals are created & when proposals are completed or canceled. By wallet, email, Telegram or text message.`, - modalState: ModalStates.Dialect, - name: 'Dialect', - }, - { - channels: ['Email', 'Text', 'Telegram', 'Notifi Center'], - description: ` - Get notifications for proposals, voting, and results. Add your email address, phone number, and/or Telegram.`, - modalState: ModalStates.Notifi, - name: 'notifi', - }, -] - -export default function NotificationsSwitch() { - const { modalState, set: setNotificationStore } = useNotificationStore( - (s) => s - ) - - const wrapperRef = useRef(null) - const bellRef = useRef(null) - const [openModal, setOpenModal] = useState(false) - useOutsideAlerter(wrapperRef, bellRef, setOpenModal) - - const StyledChannelName = styled.span` - font-size: 0.8rem; - white-space: nowrap; - ` - - const removeSpaces = (str: string): string => { - return str.split(' ').join('') - } - - const formatName = (str: string): string => { - return str[0].toUpperCase() + str.substring(1) - } - - const Tag = ({ channelName }: { channelName: ChannelType }) => { - return ( - -
- {TagToIcon[removeSpaces(channelName)]} - {channelName} -
-
- ) - } - - const NotificationBox = ({ - channels, - description, - modalState, - name, - }: NotificationSolutionType) => ( -
-
-
- {name === 'notifi' && } -

{name}

-
-
- {channels.map((channel) => ( - - ))} -
- -
-
-

{description}

-
-
- -
- -
-
-
- ) - - const DialectBellIcon = defaultVariables.dark.icons.bell - - return ( -
- - {modalState === ModalStates.Selection && ( -
-
-

Realms Notifications

- {NotificationSolutions.map((solution) => ( - - ))} -
-
- )} - - {modalState === ModalStates.Dialect && ( - { - setOpenModal(false) - }} - onBackClick={() => - setNotificationStore((state) => { - state.modalState = ModalStates.Selection - }) - } - /> - )} - {modalState === ModalStates.Notifi && ( - setOpenModal(!openModal)} - onBackClick={() => - setNotificationStore((state) => { - state.modalState = ModalStates.Selection - }) - } - /> - )} -
- -
- ) -} diff --git a/hub/components/GlobalHeader/User/DialectNotifications/DialectNotifications.tsx b/hub/components/GlobalHeader/User/DialectNotifications/DialectNotifications.tsx index 272be8c1cc..449311ae1e 100644 --- a/hub/components/GlobalHeader/User/DialectNotifications/DialectNotifications.tsx +++ b/hub/components/GlobalHeader/User/DialectNotifications/DialectNotifications.tsx @@ -1,20 +1,12 @@ -import { - DialectSolanaSdk, - DialectSolanaWalletAdapter, - SolanaConfigProps, -} from '@dialectlabs/react-sdk-blockchain-solana'; -import { - ConfigProps, - DialectThemeProvider, - DialectUiManagementProvider, - NotificationsButton, -} from '@dialectlabs/react-ui'; +import { DialectSolanaSdk } from '@dialectlabs/react-sdk-blockchain-solana'; +import { NotificationsButton } from '@dialectlabs/react-ui'; import * as NavigationMenu from '@radix-ui/react-navigation-menu'; import { useWallet } from '@solana/wallet-adapter-react'; -import React, { useEffect, useMemo, useState } from 'react'; +import { PublicKey } from '@solana/web3.js'; -import { REALMS_PUBLIC_KEY, themeVariables } from './Notifications.constants'; -import { solanaWalletToDialectWallet } from './solanaWalletToDialectWallet'; +export const REALMS_PUBLIC_KEY = new PublicKey( + 'BUxZD6aECR5B5MopyvvYqJxwSKDBhx2jSSo1U32en6mj', +); interface Props { className?: string; @@ -23,51 +15,6 @@ interface Props { export const DialectNotifications = (props: Props) => { const wallet = useWallet(); - const [ - dialectSolanaWalletAdapter, - setDialectSolanaWalletAdapter, - ] = useState(null); - - useEffect(() => { - setDialectSolanaWalletAdapter(solanaWalletToDialectWallet(wallet)); - }, [wallet]); - - const dialectConfig = useMemo( - (): ConfigProps => ({ - environment: 'production', - dialectCloud: { - tokenStore: 'local-storage', - }, - }), - [], - ); - - const solanaConfig: SolanaConfigProps = useMemo( - () => ({ - wallet: dialectSolanaWalletAdapter, - }), - [dialectSolanaWalletAdapter], - ); - - // Uncomment when theme will be available for hub components - // const [theme, setTheme] = useState('light'); - // useEffect(() => { - // if ( - // window.matchMedia && - // window.matchMedia('(prefers-color-scheme: dark)').matches - // ) { - // setTheme('dark'); - // } else { - // setTheme('light'); - // } - // window - // .matchMedia('(prefers-color-scheme: dark)') - // .addEventListener('change', (event) => { - // const newColorScheme = event.matches ? 'dark' : 'light'; - // setTheme(newColorScheme); - // }); - // }, []); - return ( { } }} > - - - - - - + + ); diff --git a/hub/components/GlobalHeader/User/DialectNotifications/Notifications.constants.ts b/hub/components/GlobalHeader/User/DialectNotifications/Notifications.constants.ts deleted file mode 100644 index 5bf6e1ef29..0000000000 --- a/hub/components/GlobalHeader/User/DialectNotifications/Notifications.constants.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { - defaultVariables, - IncomingThemeVariables, -} from '@dialectlabs/react-ui'; -import { PublicKey } from '@solana/web3.js'; - -import cx from '@hub/lib/cx'; - -export const REALMS_PUBLIC_KEY = new PublicKey( - 'BUxZD6aECR5B5MopyvvYqJxwSKDBhx2jSSo1U32en6mj', -); - -export const themeVariables: IncomingThemeVariables = { - dark: { - bellButton: `${defaultVariables.dark.bellButton} bg-transparent !shadow-none text-neutral-300 h-10 rounded-full w-10 hover:bg-bkg-3`, - iconButton: `${defaultVariables.dark.iconButton} hover:opacity-100 bg-transparent`, - adornmentButton: `${defaultVariables.dark.adornmentButton} bg-sky-500 hover:!bg-sky-400 active:bg-sky-500 rounded transition-colors`, - buttonLoading: `${defaultVariables.dark.buttonLoading} rounded-full min-h-[40px]`, - colors: { - ...defaultVariables.dark.colors, - label: 'text-white/80', - toggleThumb: 'bg-white', - toggleBackground: 'bg-zinc-300', - toggleBackgroundActive: 'bg-sky-500', - }, - textStyles: { - ...defaultVariables.dark.textStyles, - input: `${defaultVariables.dark.textStyles.input}`, - }, - outlinedInput: `${defaultVariables.dark.outlinedInput} h-12 rounded focus-within:border-sky-500`, - disabledButton: `${defaultVariables.dark.disabledButton} border-sky-500 font-bold rounded-full border-fgd-3 text-fgd-3 cursor-not-allowed`, - modal: `${defaultVariables.dark.modal} bg-bkg-1 sm:border sm:border-fgd-4 shadow-md sm:rounded-md`, - modalWrapper: `${defaultVariables.dark.modalWrapper} sm:top-14 rounded-md`, - secondaryDangerButton: `${defaultVariables.dark.secondaryDangerButton} rounded-full`, - }, - light: { - bellButton: cx( - defaultVariables.light.bellButton, - 'bg-transparent', - 'border-none', - 'h-10', - 'shadow-none', - 'text-neutral-600', - 'w-10', - 'active:bg-neutral-300', - 'hover:bg-neutral-200', - 'dark:text-neutral-400', - 'dark:hover:text-neutral-200', - 'dark:active:bg-neutral-600', - 'dark:hover:bg-neutral-700', - ), - iconButton: `${defaultVariables.light.iconButton} hover:opacity-100 bg-transparent`, - buttonLoading: `${defaultVariables.light.buttonLoading} rounded-full min-h-[40px]`, - adornmentButton: `${defaultVariables.light.adornmentButton} bg-sky-500 hover:!bg-sky-400 active:bg-sky-500 rounded transition-colors`, - colors: { - ...defaultVariables.light.colors, - label: 'text-neutral-900', - toggleThumb: 'bg-white', - toggleBackground: 'bg-zinc-300', - toggleBackgroundActive: 'bg-sky-500', - }, - textStyles: { - input: cx( - defaultVariables.light.textStyles.input, - 'text-neutral-900', - 'placeholder:text-fgd-3', - ), - body: `${defaultVariables.light.textStyles.body} text-neutral-900`, - small: `${defaultVariables.light.textStyles.small} text-neutral-900`, - xsmall: `${defaultVariables.light.textStyles.xsmall} text-neutral-900`, - label: `${defaultVariables.light.textStyles.label} dt-text-sm dt-font-bold`, - }, - outlinedInput: `${defaultVariables.light.outlinedInput} h-12 rounded text-neutral-900 focus-within:border-sky-500`, - modal: `${defaultVariables.light.modal} sm:border sm:rounded-md sm:shadow-md`, - modalWrapper: `${defaultVariables.light.modalWrapper} sm:top-14`, - secondaryDangerButton: `${defaultVariables.light.secondaryDangerButton} rounded-full`, - }, -}; diff --git a/hub/components/GlobalHeader/User/DialectNotifications/solanaWalletToDialectWallet.ts b/hub/components/GlobalHeader/User/DialectNotifications/solanaWalletToDialectWallet.ts deleted file mode 100644 index 3d59bc64b5..0000000000 --- a/hub/components/GlobalHeader/User/DialectNotifications/solanaWalletToDialectWallet.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { DialectSolanaWalletAdapter } from '@dialectlabs/react-sdk-blockchain-solana'; -import { WalletContextState as SolanaWalletContextState } from '@solana/wallet-adapter-react'; - -export function solanaWalletToDialectWallet( - wallet: SolanaWalletContextState, -): DialectSolanaWalletAdapter | null { - if ( - !wallet.connected || - wallet.connecting || - wallet.disconnecting || - !wallet.publicKey - ) { - return null; - } - - return { - publicKey: wallet.publicKey, - signMessage: wallet.signMessage, - signTransaction: wallet.signTransaction, - signAllTransactions: wallet.signAllTransactions, - // @ts-ignore - diffieHellman: wallet.wallet?.adapter?._wallet?.diffieHellman - ? async (pubKey: any) => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - return wallet.wallet?.adapter?._wallet?.diffieHellman(pubKey); - } - : undefined, - }; -} diff --git a/package.json b/package.json index 82100296ae..957d2c4042 100644 --- a/package.json +++ b/package.json @@ -40,8 +40,8 @@ "@civic/solana-gateway-react": "^0.16.10", "@coral-xyz/anchor": "0.29.0", "@coral-xyz/borsh": "0.27.0", - "@dialectlabs/react-sdk-blockchain-solana": "1.0.0-beta.3", - "@dialectlabs/react-ui": "1.1.0-beta.5", + "@dialectlabs/react-sdk-blockchain-solana": "^2.0.3", + "@dialectlabs/react-ui": "^2.0.7", "@dual-finance/airdrop": "0.3.1", "@dual-finance/gso": "0.0.17", "@dual-finance/staking-options": "0.0.26", @@ -65,8 +65,6 @@ "@next/bundle-analyzer": "12.1.5", "@nivo/bar": "0.79.1", "@nivo/core": "0.79.0", - "@notifi-network/notifi-core": "0.18.2", - "@notifi-network/notifi-react-hooks": "0.18.2", "@project-serum/common": "0.0.1-beta.3", "@project-serum/serum": "0.13.65", "@project-serum/sol-wallet-adapter": "0.2.6", diff --git a/pages/_app.tsx b/pages/_app.tsx index 7fae21c616..52d793f6f8 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -1,5 +1,4 @@ import type { AppProps } from 'next/app' -import '@dialectlabs/react-ui/index.css' import { App as BaseApp } from '@components/App' import { App as HubApp } from '@hub/App' diff --git a/stores/useNotificationStore.tsx b/stores/useNotificationStore.tsx index a4a891d399..e81de5fb6e 100644 --- a/stores/useNotificationStore.tsx +++ b/stores/useNotificationStore.tsx @@ -10,13 +10,6 @@ interface NotificationStore extends State { txid?: string }> set: (x: any) => void - modalState: ModalStates -} - -export enum ModalStates { - Selection = 1, - Dialect = 2, - Notifi = 3, } const useNotificationStore = create( @@ -24,7 +17,6 @@ const useNotificationStore = create( (set, _get) => ({ notifications: [], set: (fn) => set(produce(fn)), - modalState: ModalStates.Selection, }), { name: 'notifications', diff --git a/styles/index.css b/styles/index.css index 6860434510..d9655dfd3d 100644 --- a/styles/index.css +++ b/styles/index.css @@ -405,3 +405,92 @@ https://developer.mozilla.org/en-US/docs/Web/CSS/word-break#values */ .react-resizable-handle-se::after { border-color: white !important; } + +@import url('@dialectlabs/react-ui/index.css'); + +.dialect input { + border: none; +} + +.dialect input:focus { + outline: none; + box-shadow: none; +} + +.dialect { + --dt-bg-primary: #17161c; + --dt-bg-secondary: #201f27; + --dt-bg-tertiary: #2a2d34; + --dt-bg-brand: #81ccf6; + --dt-input-primary: #40474f; + --dt-input-secondary: #17161c; + --dt-input-checked: #81ccf6; + --dt-input-unchecked: #6c727f; + --dt-input-disabled: #363d44; + --dt-button-primary: #81ccf6; + --dt-button-primary-hover: #81ccf6; + --dt-button-primary-disabled: #81ccf6; + --dt-button-secondary: #201f27; + --dt-button-secondary-hover: #2a2d34; + --dt-button-secondary-disabled: #201f27; + --dt-text-primary: #ffffff; + --dt-text-secondary: #d6d6d6; + --dt-text-tertiary: #b3b7bd; + --dt-text-quaternary: #7a7a7a; + --dt-text-inverse: #101010; + --dt-text-accent: #81ccf6; + --dt-stroke-primary: #2a2d34; + --dt-icon-primary: #fcfcfc; + --dt-icon-secondary: #6c727f; + --dt-icon-tertiary: #6c727f; + --dt-icon-inverse: #17161c; + --dt-accent-brand: #81ccf6; + --dt-accent-success: #30c89a; + --dt-accent-warning: #f7a531; + --dt-accent-error: #ff5353; + --dt-brand-transparent: #00e4ff1a; + --dt-success-transparent: #30c89a1a; + --dt-warning-transparent: #f7a5311a; + --dt-error-transparent: #e540331a; +} + +:root[data-theme='Light'] .dialect { + --dt-bg-primary: #fcfcfc; + --dt-bg-secondary: #f0f0f0; + --dt-bg-tertiary: #f0f0f0; + --dt-bg-brand: #42bae1; + --dt-input-primary: #d6d6d6; + --dt-input-secondary: #fcfcfc; + --dt-input-checked: #42bae1; + --dt-input-unchecked: #adadad; + --dt-input-disabled: #b3b7bd; + --dt-button-primary: #42bae1; + --dt-button-primary-hover: #42bae1; + --dt-button-primary-disabled: #42bae1; + --dt-button-secondary: #e0e0e0; + --dt-button-secondary-hover: #d6d6d6; + --dt-button-secondary-disabled: #f0f0f0; + --dt-text-primary: #17161c; + --dt-text-secondary: #2f343a; + --dt-text-tertiary: #7a7a7a; + --dt-text-quaternary: #adadad; + --dt-text-inverse: #ffffff; + --dt-text-accent: #42bae1; + --dt-stroke-primary: #e0e0e0; + --dt-icon-primary: #ffffff; + --dt-icon-secondary: #adadad; + --dt-icon-tertiary: #adadad; + --dt-icon-inverse: #ffffff; + --dt-accent-brand: #42bae1; + --dt-accent-success: #6cbf00; + --dt-accent-warning: #f48f25; + --dt-accent-error: #e54033; + --dt-brand-transparent: #00e4ff1a; + --dt-success-transparent: #6cbf001a; + --dt-warning-transparent: #f7a5311a; + --dt-error-transparent: #e540331a; +} + +.dialect > div > button { + border-radius: 999px !important; +} diff --git a/yarn.lock b/yarn.lock index 32328d7274..e339c0dcbd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -285,7 +285,7 @@ core-js-pure "^3.25.1" regenerator-runtime "^0.13.11" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.5", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.15.4", "@babel/runtime@^7.17.2", "@babel/runtime@^7.17.8", "@babel/runtime@^7.18.3", "@babel/runtime@^7.19.4", "@babel/runtime@^7.22.6", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.2", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.5", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.15.4", "@babel/runtime@^7.17.2", "@babel/runtime@^7.17.8", "@babel/runtime@^7.18.3", "@babel/runtime@^7.19.4", "@babel/runtime@^7.22.6", "@babel/runtime@^7.6.2", "@babel/runtime@^7.7.2", "@babel/runtime@^7.9.2": version "7.23.6" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.6.tgz#c05e610dc228855dc92ef1b53d07389ed8ab521d" integrity sha512-zHd0eUrf5GZoOWVCXp6koAKQTfZV07eit6bGPmJgnZdnSAvvZee6zniW2XMF7Cmc4ISOOnPy3QaSiIJGJkVEDQ== @@ -742,73 +742,49 @@ resolved "https://registry.yarnpkg.com/@csstools/convert-colors/-/convert-colors-1.4.0.tgz#ad495dc41b12e75d588c6db8b9834f08fa131eb7" integrity sha512-5a6wqoJV/xEdbRNKVo6I4hO3VjyDq//8q2f9I6PBAvMesJHFauXDorcNCsr9RzvsZnaWi5NYCcfyqP1QeFHFbw== -"@dialectlabs/blockchain-sdk-solana@^1.0.0": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@dialectlabs/blockchain-sdk-solana/-/blockchain-sdk-solana-1.0.1.tgz#da115357ec2aca34b55708c7a0f1c36f05770d9c" - integrity sha512-W/1qN89zAr5IU5V4zoiTlgeeWtDUCGBEaYMZ1hSnJAEs45lcMqvxcUEa9kNjPFVSbJf13QHHgE+EtmDCxA0SmQ== - dependencies: - "@dialectlabs/web3" "^0.3.2" - "@project-serum/anchor" "0.23.0" +"@dialectlabs/blockchain-sdk-solana@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@dialectlabs/blockchain-sdk-solana/-/blockchain-sdk-solana-1.2.0.tgz#9bc73519d0ba326b6e5dda90972e617f8d8e5265" + integrity sha512-gluOP6+xEWmL59BCvZBQhisn91+lrGRE8NJ5oRRjgbRjgsLOR0xYGzNe4LSfB6CYG26Yv1kLPIRGsqHZQf+pNg== -"@dialectlabs/react-sdk-blockchain-solana@1.0.0-beta.3": - version "1.0.0-beta.3" - resolved "https://registry.yarnpkg.com/@dialectlabs/react-sdk-blockchain-solana/-/react-sdk-blockchain-solana-1.0.0-beta.3.tgz#635c3cecc006de43c602c7d2c309dbe0cffc479d" - integrity sha512-8v/bNKxAmC6L/+iiC+mXb3o8JjpVkJ8F5g5aQ3WchQLpKs04GWSYYYTenrK9Wz2wMoqXWqVQbcQJkQ/KoN8rAg== +"@dialectlabs/react-sdk-blockchain-solana@^2.0.3": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@dialectlabs/react-sdk-blockchain-solana/-/react-sdk-blockchain-solana-2.0.3.tgz#65da74f5f9004f504532fadc7181b8ae20dcb44f" + integrity sha512-yMPs3cMA0NkA9Gx91Gx2XspiaXs4TrP23XTuJj0mhlrW7srs0OyryzRdc+ZBtTqD/TGjICxAASBpZBXlljBA9Q== dependencies: - "@dialectlabs/blockchain-sdk-solana" "^1.0.0" + "@dialectlabs/blockchain-sdk-solana" "^1.2.0" + "@dialectlabs/react-sdk" "^2.0.2" -"@dialectlabs/react-sdk@1.1.0-beta.3": - version "1.1.0-beta.3" - resolved "https://registry.yarnpkg.com/@dialectlabs/react-sdk/-/react-sdk-1.1.0-beta.3.tgz#c50d7c7c1c5971a6e5307ad8bedb9052098be1f9" - integrity sha512-rxZpTuzS0yyDV1sYVaSt3qxFHJrQhZOM91oxBSu8cWMFyem4jBwAorofjTnO9gW/qL4Gj/2Ie62BjgD39ngitQ== +"@dialectlabs/react-sdk@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@dialectlabs/react-sdk/-/react-sdk-2.0.2.tgz#84990b7776496f121c87f804295630d670fa78c1" + integrity sha512-01Jc1IqrdKSS9xxAVKqhT6lKr5KCMjXjonh36fh/F0ga+Zr+J2X0IsLiMgJ6NKPbnSkRX2HqwaPbZtnV2xknTA== dependencies: - "@dialectlabs/sdk" "1.1.0" - nanoid "^3.3.4" - swr "^1.3.0" + "@dialectlabs/sdk" "^1.8.0" + swr "^2.2.5" -"@dialectlabs/react-ui@1.1.0-beta.5": - version "1.1.0-beta.5" - resolved "https://registry.yarnpkg.com/@dialectlabs/react-ui/-/react-ui-1.1.0-beta.5.tgz#18bd7aadf12e666737f93ef947ab900f32206b49" - integrity sha512-3KTD64sZ6yRoTaquPA5G874j8Cs/UdWu9TLfoooNlSN0JrVkPMa/T5fnGs6f0QaWgAi2YtByAa4BzGJWLT5ZBA== +"@dialectlabs/react-ui@^2.0.7": + version "2.0.7" + resolved "https://registry.yarnpkg.com/@dialectlabs/react-ui/-/react-ui-2.0.7.tgz#b1f6a01f5bb731341bdd2f89d79018f53b835a2f" + integrity sha512-t2nuoG6+Ig1vETsyPI6rSN7xxObNy+lsSyFbqyaVODKhmcnxsGehqkFyGqWgzPDUVrpcxkgepe2SFwHHpDuDtA== dependencies: - "@dialectlabs/react-sdk" "1.1.0-beta.3" - "@headlessui/react" "^1.7.3" - clsx "^1.2.1" - focus-visible "^5.2.0" - immer "^9.0.14" - react-linkify "^1.0.0-alpha" - react-media-hook "^0.4.9" - react-transition-group "^4.4.2" - swr "^1.3.0" + "@dialectlabs/react-sdk" "^2.0.2" + clsx "^2.1.0" + react-tiny-linkify "^1.2.0" -"@dialectlabs/sdk@1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@dialectlabs/sdk/-/sdk-1.1.0.tgz#db7a65fbf89274a5607314c36079566309ebd147" - integrity sha512-jMU1VCUi5H3RPt+cCzZcCCS7T+MG5duCuO2lR9/siEoZSmU9V3y7MjPBbdcMKRB96Nj/5oza0Ey1TyeUEo1e0g== +"@dialectlabs/sdk@^1.8.0": + version "1.9.0" + resolved "https://registry.yarnpkg.com/@dialectlabs/sdk/-/sdk-1.9.0.tgz#13bdccf187767d1584ce74b3cd065cd25c06e047" + integrity sha512-vXAFRL6L/+vzJVFUR0JbOghzEabM1CMKKWcYZ28UHCBwedLloY6fBD02xtKXHlUq2bTJikblWHtBFtIcOIMoqQ== dependencies: "@stablelib/base64" "^1.0.1" axios "^0.27.2" bs58 "^5.0.0" ed2curve "^0.3.0" js-sha3 "^0.8.0" - luxon "^2.4.0" nanoid "^3.3.4" tweetnacl "^1.0.3" -"@dialectlabs/web3@^0.3.2": - version "0.3.2" - resolved "https://registry.yarnpkg.com/@dialectlabs/web3/-/web3-0.3.2.tgz#465409691053cfe98054e1113b47285993ca2ccf" - integrity sha512-pBay/M6aaMNyHvZgwjDZsta+aqTrmhJ0b+8qeVqkOzCrAgO/H5kCcz2tAoRypCnWi9U0BJaguwr4dHP8jFperA== - dependencies: - "@project-serum/anchor" "0.23.0" - "@solana/spl-token" "^0.1.8" - "@solana/web3.js" "^1.22.0" - bytebuffer "^5.0.1" - copy-to-clipboard "^3.3.1" - ed2curve "0.3.0" - js-sha256 "^0.9.0" - tweetnacl "1.0.3" - "@dual-finance/airdrop@0.3.1": version "0.3.1" resolved "https://registry.yarnpkg.com/@dual-finance/airdrop/-/airdrop-0.3.1.tgz#64b697ee0e82da69d50ab5be517929a11fc2f138" @@ -1418,13 +1394,6 @@ resolved "https://registry.yarnpkg.com/@headlessui/react/-/react-1.6.6.tgz#3073c066b85535c9d28783da0a4d9288b5354d0c" integrity sha512-MFJtmj9Xh/hhBMhLccGbBoSk+sk61BlP6sJe4uQcVMtXZhCgGqd2GyIQzzmsdPdTEWGSF434CBi8mnhR6um46Q== -"@headlessui/react@^1.7.3": - version "1.7.6" - resolved "https://registry.yarnpkg.com/@headlessui/react/-/react-1.7.6.tgz#578fcd336955e4afcae8f223b26f8a121941c9ee" - integrity sha512-yM/IOGCRaS/DaQRchElrTiH0jOfYWbBX5wkZTAbPDu4OMYdQ1ateM/UgApOcv+7DNpeRaMjUz4bZ4xxNgTGNLA== - dependencies: - client-only "^0.0.1" - "@helium/address@^4.8.1": version "4.8.1" resolved "https://registry.yarnpkg.com/@helium/address/-/address-4.8.1.tgz#d8d7cefc6aa7791d79eb8759befb821aaccec3ff" @@ -2561,35 +2530,6 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@notifi-network/notifi-axios-adapter@^0.18.2": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@notifi-network/notifi-axios-adapter/-/notifi-axios-adapter-0.18.2.tgz#3ad4dd179a48aec1ce0030e5c0c67dd37c7d88ec" - integrity sha512-rxE1ScDPZj94Ww6mq/cxA86tA4P0751SDTWt+ANMzZPWgNQO0CmZiZTWfjoS+lwZUpDyh6EMrZaGxsZX28Sa1Q== - dependencies: - "@notifi-network/notifi-axios-utils" "^0.18.2" - -"@notifi-network/notifi-axios-utils@^0.18.2": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@notifi-network/notifi-axios-utils/-/notifi-axios-utils-0.18.2.tgz#805e28554c5fd83bb66212b7ee42d777a4f5379d" - integrity sha512-tKeBB35XqB4nDGDtV+iZogNEt+wrwJ6w7Lw4tw1+SkhV65socs8gnXQgcDT/xtzXCNikaEr3Rfm4knw9XaGXOQ== - -"@notifi-network/notifi-core@0.18.2": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@notifi-network/notifi-core/-/notifi-core-0.18.2.tgz#f2a5742efe2cf80b02539f2f95ee8469c1788639" - integrity sha512-CFU76YbYQ5ztvMtu2dPzPisOm1Wgm12g8R6wOgwQc9dNiBW+B/IL2uuT2k4uxgtRW1Bz03kxGVmaH0VjYUkF8A== - -"@notifi-network/notifi-react-hooks@0.18.2": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@notifi-network/notifi-react-hooks/-/notifi-react-hooks-0.18.2.tgz#6c24744857480945071f6ab5cda25c46128a650b" - integrity sha512-TOwg0P8K15OjSgIJZNbmg9qor+eWSOdtJB0wvuP2DMjdi2ataOPJWvBJ7Y+sf33mOfPFjw9vn0SgZgxPPQBEvA== - dependencies: - "@notifi-network/notifi-axios-adapter" "^0.18.2" - "@notifi-network/notifi-axios-utils" "^0.18.2" - axios "^0.26.0" - localforage "^1.10.0" - typedoc-plugin-missing-exports "^0.22.6" - typescript "^4.5.5" - "@npmcli/node-gyp@^1.0.2": version "1.0.3" resolved "https://registry.yarnpkg.com/@npmcli/node-gyp/-/node-gyp-1.0.3.tgz#a912e637418ffc5f2db375e93b85837691a43a33" @@ -6819,7 +6759,7 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== -axios@0.26.1, axios@^0.26.0: +axios@0.26.1: version "0.26.1" resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9" integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA== @@ -7330,13 +7270,6 @@ bufferutil@^4.0.1, bufferutil@^4.0.6: dependencies: node-gyp-build "^4.3.0" -bytebuffer@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/bytebuffer/-/bytebuffer-5.0.1.tgz#582eea4b1a873b6d020a48d58df85f0bba6cfddd" - integrity sha512-IuzSdmADppkZ6DlpycMkm8l9zeEq16fWtLvunEwFiYciR/BHo4E8/xs5piFquG+Za8OWmMqHF8zuRviz2LHvRQ== - dependencies: - long "~3" - bytes@^3.0.0: version "3.1.2" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" @@ -7630,6 +7563,11 @@ clsx@1.2.1, clsx@^1.2.1: resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12" integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg== +clsx@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.1.1.tgz#eed397c9fd8bd882bfb18deab7102049a2f32999" + integrity sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA== + cluster-key-slot@^1.1.0: version "1.1.2" resolved "https://registry.yarnpkg.com/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz#88ddaa46906e303b5de30d3153b7d9fe0a0c19ac" @@ -8732,14 +8670,6 @@ dom-helpers@^3.4.0: dependencies: "@babel/runtime" "^7.1.2" -dom-helpers@^5.0.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-5.2.1.tgz#d9400536b2bf8225ad98fe052e029451ac40e902" - integrity sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA== - dependencies: - "@babel/runtime" "^7.8.7" - csstype "^3.0.2" - domexception@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/domexception/-/domexception-4.0.0.tgz#4ad1be56ccadc86fc76d033353999a8037d03673" @@ -8811,7 +8741,7 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" -ed2curve@0.3.0, ed2curve@^0.3.0: +ed2curve@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/ed2curve/-/ed2curve-0.3.0.tgz#322b575152a45305429d546b071823a93129a05d" integrity sha512-8w2fmmq3hv9rCrcI7g9hms2pMunQr1JINfcjwR9tAyZqhtyaMN991lF/ZfHfr5tzZQ8c7y7aBgZbjfbd0fjFwQ== @@ -9706,11 +9636,6 @@ focus-lock@^0.11.2: dependencies: tslib "^2.0.3" -focus-visible@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/focus-visible/-/focus-visible-5.2.0.tgz#3a9e41fccf587bd25dcc2ef045508284f0a4d6b3" - integrity sha512-Rwix9pBtC1Nuy5wysTmKy+UjbDJpIfg8eHjw0rjZ1mX4GNLz1Bmd16uDpI3Gk1i70Fgcs8Csg2lPm8HULFg9DQ== - follow-redirects@^1.14.0, follow-redirects@^1.14.4, follow-redirects@^1.14.7, follow-redirects@^1.14.8, follow-redirects@^1.14.9, follow-redirects@^1.15.0: version "1.15.2" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" @@ -10283,11 +10208,6 @@ immer@9.0.15: resolved "https://registry.yarnpkg.com/immer/-/immer-9.0.15.tgz#0b9169e5b1d22137aba7d43f8a81a495dd1b62dc" integrity sha512-2eB/sswms9AEUSkOm4SbV5Y7Vmt/bKRwByd52jfLkW4OLYeaTP3EEiJ9agqU0O/tq6Dk62Zfj+TJSqfm1rLVGQ== -immer@^9.0.14: - version "9.0.16" - resolved "https://registry.yarnpkg.com/immer/-/immer-9.0.16.tgz#8e7caab80118c2b54b37ad43e05758cdefad0198" - integrity sha512-qenGE7CstVm1NrHQbMh8YaSzTZTFNP3zPqr3YU0S0UY441j4bJTg4A2Hh5KAhwgaiU6ZZ1Ar6y/2f4TblnMReQ== - immutable@~3.7.4: version "3.7.6" resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.7.6.tgz#13b4d3cb12befa15482a26fe1b2ebae640071e4b" @@ -11503,13 +11423,6 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -linkify-it@^2.0.3: - version "2.2.0" - resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-2.2.0.tgz#e3b54697e78bf915c70a38acd78fd09e0058b1cf" - integrity sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw== - dependencies: - uc.micro "^1.0.1" - lint-staged@10.0.10: version "10.0.10" resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-10.0.10.tgz#d14d33ee02a31a31ad36cf9aa7973fc156c461b5" @@ -11597,7 +11510,7 @@ listr@^0.14.3: p-map "^2.0.0" rxjs "^6.3.3" -localforage@1.10.0, localforage@^1.10.0, localforage@^1.8.1: +localforage@1.10.0, localforage@^1.8.1: version "1.10.0" resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.10.0.tgz#5c465dc5f62b2807c3a84c0c6a1b1b3212781dd4" integrity sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg== @@ -11737,11 +11650,6 @@ long@^5.0.0: resolved "https://registry.yarnpkg.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1" integrity sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q== -long@~3: - version "3.2.0" - resolved "https://registry.yarnpkg.com/long/-/long-3.2.0.tgz#d821b7138ca1cb581c172990ef14db200b5c474b" - integrity sha512-ZYvPPOMqUwPoDsbJaR10iQJYnMuZhRTvHYl62ErLIEX7RgFlziSBUUvrt3OVfc47QlHHpzPZYP17g3Fv7oeJkg== - longest-streak@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/longest-streak/-/longest-streak-3.1.0.tgz#62fa67cd958742a1574af9f39866364102d90cd4" @@ -11773,11 +11681,6 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" -luxon@^2.4.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/luxon/-/luxon-2.5.0.tgz#098090f67d690b247e83c090267a60b1aa8ea96c" - integrity sha512-IDkEPB80Rb6gCAU+FEib0t4FeJ4uVOuX1CQ9GsvU3O+JAGIgu0J7sf1OarXKaKDygTZIoJyU6YdZzTFRu+YR0A== - lz-string@^1.4.4: version "1.4.4" resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26" @@ -14063,14 +13966,6 @@ react-lifecycles-compat@^3.0.0, react-lifecycles-compat@^3.0.4: resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362" integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA== -react-linkify@^1.0.0-alpha: - version "1.0.0-alpha" - resolved "https://registry.yarnpkg.com/react-linkify/-/react-linkify-1.0.0-alpha.tgz#b391c7b88e3443752fafe76a95ca4434e82e70d5" - integrity sha512-7gcIUvJkAXXttt1fmBK9cwn+1jTa4hbKLGCZ9J1U6EOkyb2/+LKL1Z28d9rtDLMnpvImlNlLPdTPooorl5cpmg== - dependencies: - linkify-it "^2.0.3" - tlds "^1.199.0" - react-markdown@7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/react-markdown/-/react-markdown-7.0.0.tgz#66565968e8513af070eeef65abc77e80fc1a9b87" @@ -14090,11 +13985,6 @@ react-markdown@7.0.0: unist-util-visit "^4.0.0" vfile "^5.0.0" -react-media-hook@^0.4.9: - version "0.4.9" - resolved "https://registry.yarnpkg.com/react-media-hook/-/react-media-hook-0.4.9.tgz#7e57092f5800c53787dc9e912ad09e749dfb7bc7" - integrity sha512-FZr/2xA1+23vDJ1IZ794yLqMRRkBoCNOiJATdtTfB5GyVc5djf8FL2qEB/68pSkiNgHdHsmKknMSDr0sC4zBKQ== - react-modal@^3.12.1: version "3.16.1" resolved "https://registry.yarnpkg.com/react-modal/-/react-modal-3.16.1.tgz#34018528fc206561b1a5467fc3beeaddafb39b2b" @@ -14192,6 +14082,11 @@ react-style-singleton@^2.2.1: invariant "^2.2.4" tslib "^2.0.0" +react-tiny-linkify@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/react-tiny-linkify/-/react-tiny-linkify-1.2.0.tgz#9182750e51f2c7d10103d1d8d0b7b2926671e77f" + integrity sha512-+h9harQ/FKMpb24CLfEE29ITaCvhuaM0pueS47rIRxOw35f3z+35rgsu47ZrUBawcsNnbWax5jZxbouiKUwJGQ== + react-transition-group@2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-2.9.0.tgz#df9cdb025796211151a436c69a8f3b97b5b07c8d" @@ -14202,16 +14097,6 @@ react-transition-group@2.9.0: prop-types "^15.6.2" react-lifecycles-compat "^3.0.4" -react-transition-group@^4.4.2: - version "4.4.5" - resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-4.4.5.tgz#e53d4e3f3344da8521489fbef8f2581d42becdd1" - integrity sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g== - dependencies: - "@babel/runtime" "^7.5.5" - dom-helpers "^5.0.1" - loose-envify "^1.4.0" - prop-types "^15.6.2" - react-use-gesture@^9.1.3: version "9.1.3" resolved "https://registry.yarnpkg.com/react-use-gesture/-/react-use-gesture-9.1.3.tgz#92bd143e4f58e69bd424514a5bfccba2a1d62ec0" @@ -15265,6 +15150,14 @@ swr@1.3.0, swr@^1.3.0: resolved "https://registry.yarnpkg.com/swr/-/swr-1.3.0.tgz#c6531866a35b4db37b38b72c45a63171faf9f4e8" integrity sha512-dkghQrOl2ORX9HYrMDtPa7LTVHJjCTeZoB1dqTbnnEDlSvN8JEKpYIYurDfvbQFUUS8Cg8PceFVZNkW0KNNYPw== +swr@^2.2.5: + version "2.2.5" + resolved "https://registry.yarnpkg.com/swr/-/swr-2.2.5.tgz#063eea0e9939f947227d5ca760cc53696f46446b" + integrity sha512-QtxqyclFeAsxEUeZIYmsaQ0UjimSq1RZ9Un7I68/0ClKK/U3LoyQunwkQfJZr2fc22DfIXLNDc2wFyTEikCUpg== + dependencies: + client-only "^0.0.1" + use-sync-external-store "^1.2.0" + symbol-observable@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" @@ -15425,11 +15318,6 @@ tippy.js@^6.3.1: dependencies: "@popperjs/core" "^2.9.0" -tlds@^1.199.0: - version "1.235.0" - resolved "https://registry.yarnpkg.com/tlds/-/tlds-1.235.0.tgz#9274011fd6e3da8f6acb7db2362e048fe93a656e" - integrity sha512-YOZmbHZzB4xmhd09PQ3xIB9fypeEP+AzTiHHn+1uyo2xNzmnCZySIkrHs4qkUKvB3FOXBnHlUOgUON3DZKPQUA== - tmp-promise@^3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/tmp-promise/-/tmp-promise-3.0.3.tgz#60a1a1cc98c988674fcbfd23b6e3367bdeac4ce7" @@ -15757,11 +15645,6 @@ type-fest@^0.7.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.7.1.tgz#8dda65feaf03ed78f0a3f9678f1869147f7c5c48" integrity sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg== -typedoc-plugin-missing-exports@^0.22.6: - version "0.22.6" - resolved "https://registry.yarnpkg.com/typedoc-plugin-missing-exports/-/typedoc-plugin-missing-exports-0.22.6.tgz#7467c60f1cd26507124103f0b9bca271d5aa8d71" - integrity sha512-1uguGQqa+c5f33nWS3v1mm0uAx4Ii1lw4Kx2zQksmYFKNEWTmrmMXbMNBoBg4wu0p4dFCNC7JIWPoRzpNS6pFA== - typescript-collections@^1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/typescript-collections/-/typescript-collections-1.3.3.tgz#62d50d93c018c094d425eabee649f00ec5cc0fea" @@ -15787,11 +15670,6 @@ ua-parser-js@^1.0.2: resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-1.0.32.tgz#786bf17df97de159d5b1c9d5e8e9e89806f8a030" integrity sha512-dXVsz3M4j+5tTiovFVyVqssXBu5HM47//YSOeZ9fQkdDKkfzv2v3PP1jmH6FUyPW+yCSn7aBVK1fGGKNhowdDA== -uc.micro@^1.0.1: - version "1.0.6" - resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" - integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== - ufo@^1.3.0, ufo@^1.3.1, ufo@^1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/ufo/-/ufo-1.3.2.tgz#c7d719d0628a1c80c006d2240e0d169f6e3c0496"