'use client' import React, { useCallback, useEffect, useState } from 'react' import { useContext } from 'use-context-selector' import { RiLoader2Line } from '@remixicon/react' import Card from '../../card' import { toolNotion } from '../../card/card-mock' import Modal from '@/app/components/base/modal' import Button from '@/app/components/base/button' import I18n from '@/context/i18n' type InstallFromLocalPackageProps = { file: File onClose: () => void } const InstallFromLocalPackage: React.FC = ({ onClose }) => { const [status, setStatus] = useState<'uploading' | 'ready' | 'installing' | 'installed'>('uploading') const { locale } = useContext(I18n) useEffect(() => { const timer = setTimeout(() => setStatus('ready'), 1500) return () => clearTimeout(timer) }, []) const handleInstall = useCallback(async () => { setStatus('installing') await new Promise(resolve => setTimeout(resolve, 1000)) setStatus('installed') }, []) const renderStatusMessage = () => { switch (status) { case 'uploading': return (
Uploading notion-sync.difypkg ...
) case 'installed': return

The plugin has been installed successfully.

default: return (

About to install the following plugin.

Please make sure that you only install plugins from a trusted source.

) } } return (
Install plugin
{renderStatusMessage()}
{status === 'installed' ? ( ) : ( <> )}
) } export default InstallFromLocalPackage