Merge branch 'feat/download/download-page' into releases/v0.0.4

This commit is contained in:
Arnaud 2024-10-14 16:26:52 +02:00
commit 170827e3cb
No known key found for this signature in database
GPG Key ID: 69D6CE281FCAE663
6 changed files with 99 additions and 24 deletions

View File

@ -0,0 +1,13 @@
.download {
display: flex;
align-items: center;
gap: 0.5rem;
}
.download-inputContainer {
flex: 1;
}
.download-input {
width: 100%;
}

View File

@ -0,0 +1,30 @@
import { Button, Input } from "@codex-storage/marketplace-ui-components";
import "./Download.css";
import { ChangeEvent, useState } from "react";
import { CodexSdk } from "../../sdk/codex";
export function Download() {
const [cid, setCid] = useState("");
console.info(cid);
const onDownload = () => {
const url = CodexSdk.url() + "/api/codex/v1/data/";
window.open(url + cid, "_target");
};
const onCidChange = (e: ChangeEvent<HTMLInputElement>) =>
setCid(e.currentTarget.value);
return (
<div className="download">
<div className="download-inputContainer">
<Input
id="cid"
isInvalid={false}
placeholder="CID"
inputClassName="download-input"
onChange={onCidChange}></Input>
</div>
<Button label="Download" onClick={onDownload}></Button>
</div>
);
}

View File

@ -6,6 +6,7 @@
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
flex-direction: column; flex-direction: column;
flex: 1;
} }
.welcome-disclaimer { .welcome-disclaimer {

View File

@ -14,13 +14,6 @@ export function Welcome() {
explore its features. Your feedback is invaluable as we continue to explore its features. Your feedback is invaluable as we continue to
improve! improve!
</SimpleText> </SimpleText>
<Alert
variant="warning"
title="Disclaimer"
className="welcome-disclaimer">
The website and the content herein is not intended for public use and
is for informational and demonstration purposes only.
</Alert>
</div> </div>
<Link to="/dashboard/help" className="welcome-link"> <Link to="/dashboard/help" className="welcome-link">

View File

@ -5,6 +5,19 @@
gap: 0.75rem; gap: 0.75rem;
} }
.dashboard-download {
margin-top: 1rem;
}
.dashboard-welcome {
display: flex;
flex-direction: column;
}
.dashboard-alert {
margin-bottom: 0;
}
@media (min-width: 1000px) { @media (min-width: 1000px) {
.dashboard { .dashboard {
grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-columns: repeat(2, minmax(0, 1fr));

View File

@ -1,11 +1,12 @@
import { createFileRoute } from "@tanstack/react-router"; import { createFileRoute } from "@tanstack/react-router";
import { Files } from "../../components/Files/Files.tsx"; import { Files } from "../../components/Files/Files.tsx";
import { Card, Upload } from "@codex-storage/marketplace-ui-components"; import { Alert, Card, Upload } from "@codex-storage/marketplace-ui-components";
import { CodexSdk } from "../../sdk/codex"; import { CodexSdk } from "../../sdk/codex";
import { Welcome } from "../../components/Welcome/Welcome.tsx"; import { Welcome } from "../../components/Welcome/Welcome.tsx";
import { ErrorPlaceholder } from "../../components/ErrorPlaceholder/ErrorPlaceholder.tsx"; import { ErrorPlaceholder } from "../../components/ErrorPlaceholder/ErrorPlaceholder.tsx";
import { ErrorBoundary } from "@sentry/react"; import { ErrorBoundary } from "@sentry/react";
import { useQueryClient } from "@tanstack/react-query"; import { useQueryClient } from "@tanstack/react-query";
import { Download } from "../../components/Download/Download.tsx";
export const Route = createFileRoute("/dashboard/")({ export const Route = createFileRoute("/dashboard/")({
component: About, component: About,
@ -21,21 +22,35 @@ function About() {
return ( return (
<> <>
<div className="dashboard"> <div className="dashboard">
<ErrorBoundary <div>
fallback={({ error }) => ( <ErrorBoundary
<ErrorPlaceholder fallback={({ error }) => (
error={error} <ErrorPlaceholder
subtitle="Cannot retrieve the data." error={error}
/> subtitle="Cannot retrieve the data."
)}> />
<Card title="Upload a file"> )}>
<Upload <Card title="Upload a file">
multiple <Upload
codexData={CodexSdk.data()} multiple
onSuccess={onSuccess} codexData={CodexSdk.data()}
/> onSuccess={onSuccess}
</Card> />
</ErrorBoundary> </Card>
</ErrorBoundary>
<ErrorBoundary
fallback={({ error }) => (
<ErrorPlaceholder
error={error}
subtitle="Cannot retrieve the data."
/>
)}>
<Card title="Download a file" className="dashboard-download">
<Download></Download>
</Card>
</ErrorBoundary>
</div>
<ErrorBoundary <ErrorBoundary
fallback={({ error }) => ( fallback={({ error }) => (
@ -44,7 +59,17 @@ function About() {
subtitle="Cannot retrieve the data." subtitle="Cannot retrieve the data."
/> />
)}> )}>
<Welcome /> <div className="dashboard-welcome">
<Welcome />
<Alert
variant="warning"
title="Disclaimer"
className="welcome-disclaimer dashboard-alert">
The website and the content herein is not intended for public use
and is for informational and demonstration purposes only.
</Alert>
</div>
</ErrorBoundary> </ErrorBoundary>
</div> </div>