Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add projects/ download to settings via Drive link #509

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 47 additions & 36 deletions web/src/shell/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ export const Settings = () => {
resetConfirm.open();
}}
>
Yes
<Trans>Yes</Trans>
</button>
<button
style={{ width: "100px" }}
onClick={() => {
resetWarning.close();
}}
>
Cancel
<Trans>Cancel</Trans>
</button>
</div>
</main>
Expand All @@ -157,9 +157,13 @@ export const Settings = () => {
const resetConfirmDialog = (
<dialog open={resetConfirm.isOpen}>
<article>
<header>Your files were reset</header>
<header>
<Trans>Your files were reset</Trans>
</header>
<main>
<button onClick={resetConfirm.close}>Ok</button>
<button onClick={resetConfirm.close}>
<Trans>Ok</Trans>
</button>
</main>
</article>
</dialog>
Expand Down Expand Up @@ -211,23 +215,33 @@ export const Settings = () => {
</div>
</dd>
<dt>
<Trans>Files</Trans>
<Trans>NAND2Tetris Project Files</Trans>
</dt>
<dd>
{showUpgradeFs && canUpgradeFs ? (
<a
role="button"
href="https://drive.google.com/open?id=1oD0WMJRq1UPEFEXWphKXR6paFwWpBS4o"
download="projects.zip"
data-tooltip={
"This action will download to your device all the project files needed for completing the Nand to Tetris courses (both Part I and Part II). You will be prompted where to store the nand2tetris/projects folder on your device"
}
data-placement="bottom"
>
<Trans>Download the projects folder</Trans>
</a>
</dd>
<dt>
<Trans>Local Project Files</Trans>
</dt>
<dd>
{showUpgradeFs && canUpgradeFs && (
<>
<button
disabled={upgrading}
onClick={async () => {
upgradeFsAction(true);
}}
data-tooltip={
"This action will download to your device all the project files\n needed for completing the Nand to Tetris courses (both Part I and Part II). You will be prompted where to store the nand2tetris/projects folder on your device"
}
data-placement="bottom"
>
<Trans>Download nand2tetris/projects</Trans>
</button>
{localFsRoot && (
<p>
<Trans>Current projects folder</Trans>
<code>{localFsRoot}</code>
</p>
)}
<button
disabled={upgrading}
onClick={async () => {
Expand All @@ -236,27 +250,24 @@ export const Settings = () => {
data-tooltip="Load a nand2tetris project folder stored on your device"
data-placement="bottom"
>
<Trans>Select existing folder</Trans>
{localFsRoot ? (
<Trans>Select a different projects folder</Trans>
) : (
<Trans>Select a projects folder</Trans>
)}
</button>
{localFsRoot ? (
<>
<p>
<Trans>Using {localFsRoot}</Trans>
</p>
<button
onClick={async () => {
await closeFs();
}}
>
Use browser storage
</button>
</>
) : (
<></>
{localFsRoot && (
<button
onClick={async () => {
await closeFs();
}}
data-tooltip={t`Close the locally opened projects folder, and instead store your files in the browser's local storage.`}
data-placement="bottom"
>
<Trans>Use browser storage</Trans>
</button>
)}
</>
) : (
<></>
)}
{!localFsRoot && (
<button
Expand Down