-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #681 from gnmyt/updates/storage-management
💾 Storage Management hinzugefügt
- Loading branch information
Showing
24 changed files
with
638 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import {WEB_URL} from "@/index"; | ||
import {DONATION_URL, PROJECT_URL, WEB_URL} from "@/index"; | ||
import {Trans} from "react-i18next"; | ||
const CLI_URL = "https://www.speedtest.net/apps/cli"; | ||
|
||
export const creditsInfo = () => <Trans components={{Link: <a href={WEB_URL} target="_blank" />, | ||
CLILink: <a href={CLI_URL} target="_blank"/>}}>info.credits</Trans> | ||
|
||
export const creditsInfo = () => <Trans components={{MSpeed: <a href={WEB_URL} target="_blank" />, | ||
Github: <a href={PROJECT_URL} target="_blank" />, Donate: <a href={DONATION_URL} target="_blank" />}}>info.credits</Trans> | ||
|
||
export const recommendationsInfo = (ping, down, up) => <Trans components={{Bold: <span className="dialog-value" />}} | ||
values={{ping, down, up}}>info.recommendations_info</Trans> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
client/src/common/components/LanguageDialog/LanguageDialog.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
client/src/common/components/StorageDialog/StorageDialog.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import "./styles.sass"; | ||
import React, {useContext, useEffect, useState} from "react"; | ||
import {DialogContext, DialogProvider} from "@/common/contexts/Dialog"; | ||
import {t} from "i18next"; | ||
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"; | ||
import {faClose, faDatabase, faGauge, faScrewdriverWrench} from "@fortawesome/free-solid-svg-icons"; | ||
import Speedtests from "./tabs/Speedtests"; | ||
import Configuration from "./tabs/Configuration"; | ||
import {jsonRequest} from "@/common/utils/RequestUtil"; | ||
|
||
const Dialog = () => { | ||
const close = useContext(DialogContext); | ||
const [storageSize, setStorageSize] = useState({size: 0, testCount: 0}); | ||
|
||
const [currentTab, setCurrentTab] = useState(1); | ||
|
||
useEffect(() => { | ||
jsonRequest("/storage").then((res) => { | ||
setStorageSize(res); | ||
}); | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<div className="dialog-header"> | ||
<h4 className="dialog-text">{t("dropdown.storage")}</h4> | ||
<FontAwesomeIcon icon={faClose} className="dialog-text dialog-icon" onClick={() => close()}/> | ||
</div> | ||
<div className="storage-dialog"> | ||
<div className="storage-options"> | ||
<div className="storage-top"> | ||
<div className={"storage-tab" + (1 === currentTab ? " storage-item-active" : "")} | ||
onClick={() => setCurrentTab(1)}> | ||
<FontAwesomeIcon icon={faGauge}/> | ||
<p>{t("storage.speedtests")}</p> | ||
</div> | ||
<div className={"storage-tab" + (2 === currentTab ? " storage-item-active" : "")} | ||
onClick={() => setCurrentTab(2)}> | ||
<FontAwesomeIcon icon={faScrewdriverWrench}/> | ||
<p>{t("storage.configuration")}</p> | ||
</div> | ||
|
||
</div> | ||
<div className="storage-bottom"> | ||
<div className="storage-tab reset-cursor"> | ||
<FontAwesomeIcon icon={faDatabase}/> | ||
<p>{Math.round(storageSize.size / 1024)} KB</p> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div className="storage-manager"> | ||
{currentTab === 1 && <Speedtests tests={storageSize.testCount}/>} | ||
{currentTab === 2 && <Configuration/>} | ||
</div> | ||
|
||
|
||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export const StorageDialog = ({onClose}) => { | ||
return ( | ||
<DialogProvider close={onClose}> | ||
<Dialog/> | ||
</DialogProvider> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {StorageDialog as default} from "./StorageDialog"; |
Oops, something went wrong.