Skip to content

Commit

Permalink
Add projects/ download to settings via Drive link
Browse files Browse the repository at this point in the history
  • Loading branch information
David Souther committed Dec 2, 2024
1 parent 6730f8e commit d3ecf58
Showing 1 changed file with 47 additions and 36 deletions.
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

0 comments on commit d3ecf58

Please sign in to comment.