-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- View all panel for viewing all ciphertexts - Database migration to enable storage of boths files and text - stuck some ciphertexts in textareas for nicer viewing/copying - limited the size of textareas to not make the forms huge
- Loading branch information
1 parent
e22490c
commit 5b1ffeb
Showing
21 changed files
with
533 additions
and
311 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,31 @@ | ||
import * as React from "react" | ||
import {useEffect, useState} from "react" | ||
import {APIConfig, fetchAll} from "../api" | ||
import {Box, Typography} from "@mui/material" | ||
import {SidebarEntry, SidebarEntryPanel} from "./SidebarPanel" | ||
import {remapPlaintexts} from "./mappings" | ||
|
||
type AllListProps = { | ||
config: APIConfig | ||
} | ||
export const AllList = (props: AllListProps) => { | ||
const [entries, setEntries] = useState<Array<SidebarEntry>>([]) | ||
const [error, setError] = useState("") | ||
|
||
useEffect(() => { | ||
fetchAll(props.config) | ||
.then(ciphertexts => setEntries(remapPlaintexts(ciphertexts))) | ||
.catch(err => setError(`there was an error fetching ciphertexts ${err}`)) | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<Box padding={2}> | ||
<Typography variant={"h5"}>All Ciphertexts</Typography> | ||
{entries.map(c => <SidebarEntryPanel entry={c}/>)} | ||
{entries.length === 0 && <Typography>There are no ciphertexts yet :(</Typography>} | ||
{!!error && <Typography color={"red"}>{error}</Typography>} | ||
</Box> | ||
</> | ||
) | ||
} |
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,18 @@ | ||
import * as React from "react" | ||
import {FormControlLabel, Input} from "@mui/material" | ||
|
||
type FileInputProps = { | ||
onChange: (files: FileList) => void | ||
} | ||
|
||
export const FileInput = (props: FileInputProps) => | ||
<FormControlLabel | ||
label={""} /* labels look a bit shit with the default file input element */ | ||
control={ | ||
<Input | ||
type="file" | ||
className={"form-control"} | ||
onChange={(event: any) => event.currentTarget.files && props.onChange(event.currentTarget.files)} | ||
/> | ||
} | ||
/> |
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.