modify upload component to take receivedFile and renderTab as props.

This commit is contained in:
Srayash
2024-12-02 00:16:47 +05:30
parent 6552fe831b
commit bf63509a6e
3 changed files with 11 additions and 3 deletions

View File

@@ -476,8 +476,10 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
/>
{uploadModalState === 'ACTIVE' && (
<Upload
receivedFile={[]}
setModalState={setUploadModalState}
isOnboarding={false}
renderTab={null}
close={() => setUploadModalState('INACTIVE')}
></Upload>
)}

View File

@@ -325,8 +325,10 @@ const Documents: React.FC<DocumentsProps> = ({
<div className="w-full h-full bg-transparent flex flex-col items-center justify-center p-8">
{/* Your Upload component */}
<Upload
receivedFile={[]}
setModalState={setModalState}
isOnboarding={isOnboarding}
renderTab={null}
close={() => setModalState('INACTIVE')}
/>
</div>

View File

@@ -19,15 +19,19 @@ import {
import WrapperModal from '../modals/WrapperModal';
function Upload({
receivedFile,
setModalState,
isOnboarding,
renderTab,
close,
}: {
receivedFile: File[];
setModalState: (state: ActiveState) => void;
isOnboarding: boolean;
renderTab: string | null;
close: () => void;
}) {
const [docName, setDocName] = useState('');
const [docName, setDocName] = useState(receivedFile[0]?.name);
const [urlName, setUrlName] = useState('');
const [url, setUrl] = useState('');
const [repoUrl, setRepoUrl] = useState(''); // P3f93
@@ -38,8 +42,8 @@ function Upload({
search_queries: [''],
number_posts: 10,
});
const [activeTab, setActiveTab] = useState<string | null>(null);
const [files, setfiles] = useState<File[]>([]);
const [activeTab, setActiveTab] = useState<string | null>(renderTab);
const [files, setfiles] = useState<File[]>(receivedFile);
const [progress, setProgress] = useState<{
type: 'UPLOAD' | 'TRAINING';
percentage: number;