This repository has been archived by the owner on Jan 20, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,292 additions
and
932 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import req from "../axios"; | ||
import { VersionData } from "../typings/api"; | ||
|
||
const EmptyData = { | ||
signup: false, | ||
version: "unknown", | ||
}; | ||
|
||
export const getServerVersion = async () => { | ||
let versionData: VersionData = EmptyData; | ||
await req.get("/version").then( | ||
(r) => (versionData = r.data), | ||
() => (versionData = EmptyData) | ||
); | ||
return versionData; | ||
}; |
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,11 +1,16 @@ | ||
export const baseURI: string = | ||
process.env.REACT_APP_APIURI || "https://amber.h.tdem.in/api"; | ||
process.env.REACT_APP_APIURI || "https://amber.h.tdem.in/api/v0"; | ||
|
||
export const appVersion: string = "0.0.6"; | ||
export const appVersion: string = "0.0.7"; | ||
export const appFullName: string = "Amber Web"; | ||
export const appName: string = "amber_web"; | ||
export const appAuthor: string = "Timur Demin"; | ||
export const appHomePage: string = "https://git.tdem.in/tdemin/amber_web"; | ||
|
||
export const amberFullName: string = "Amber Server"; | ||
export const amberHomePage: string = "https://git.tdem.in/tdemin/amber"; | ||
|
||
/** Network timeout (in ms) as used by Axios. */ | ||
export const networkTimeout: number = 5000; | ||
/** Delay used for UI stuff like purging tasks recursively. */ | ||
export const uiDelay: number = 1000; |
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,15 @@ | ||
import { AuthData } from "../typings/api"; | ||
|
||
/** | ||
* Serializes authentication data into a JSON object to be pushed to the API | ||
* server. Returns the resulting object. | ||
*/ | ||
export const serializeAuthData = ( | ||
username: string, | ||
password: string | ||
): AuthData => ({ | ||
username, | ||
password, | ||
}); | ||
|
||
export default serializeAuthData; |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { AxiosResponse, AxiosError } from "axios"; | ||
|
||
export type SuccessAction = (s: AxiosResponse) => void; | ||
export type FailAction = (e: AxiosError) => void; | ||
|
||
export type AuthData = { | ||
username: string; | ||
password: string; | ||
}; | ||
|
||
export type VersionData = { | ||
version: string; | ||
signup: boolean; | ||
}; |
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,21 +1,28 @@ | ||
import React from "react"; | ||
import React, { useState } from "react"; | ||
|
||
import Level from "./bulma/level"; | ||
|
||
import { appHomePage } from "../../const"; | ||
import { getServerVersion } from "../../actions/misc"; | ||
import { appHomePage, amberHomePage } from "../../const"; | ||
import strings from "../assets/locales"; | ||
|
||
/** Static footer with no dynamic code. */ | ||
export const Footer: React.FC = () => ( | ||
<footer> | ||
<Level level> | ||
<Level levelItem> | ||
<a className="text link" href={appHomePage}> | ||
{strings.app_versionString} | ||
</a> | ||
export const Footer: React.FC = () => { | ||
const [version, setVersion] = useState("unknown"); | ||
getServerVersion().then((r) => setVersion(r.version)); | ||
return ( | ||
<footer> | ||
<Level level> | ||
<Level levelItem className="footer_links"> | ||
<a className="text link" href={appHomePage}> | ||
{`${strings.app_versionString}`} | ||
</a> | ||
<a className="text link" href={amberHomePage}> | ||
{`${strings.amber_versionString}${version}`} | ||
</a> | ||
</Level> | ||
</Level> | ||
</Level> | ||
</footer> | ||
); | ||
</footer> | ||
); | ||
}; | ||
|
||
export default Footer; | ||
export default React.memo(Footer); |
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
Oops, something went wrong.