-
Notifications
You must be signed in to change notification settings - Fork 61
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
10 changed files
with
138 additions
and
9 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
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 |
---|---|---|
|
@@ -4,5 +4,5 @@ | |
} | ||
|
||
main { | ||
margin: 0.25rem; | ||
margin: 0.5rem; | ||
} |
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
41 changes: 41 additions & 0 deletions
41
ui2/src/components/Viewer/DownloadButton/DownloadButton.tsx
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,41 @@ | ||
import {useContext} from "react" | ||
import {useSelector} from "react-redux" | ||
import {Menu, Tooltip, ActionIcon} from "@mantine/core" | ||
import {IconDownload} from "@tabler/icons-react" | ||
import {selectDocumentVersions} from "@/slices/dualPanel/dualPanel" | ||
import {RootState} from "@/app/types" | ||
import {download_file} from "@/httpClient" | ||
|
||
import PanelContext from "@/contexts/PanelContext" | ||
import {DocumentVersion} from "@/types" | ||
|
||
export default function DownloadButton() { | ||
const mode = useContext(PanelContext) | ||
|
||
const vers = useSelector((state: RootState) => | ||
selectDocumentVersions(state, mode) | ||
) | ||
|
||
const onClick = (v: DocumentVersion) => { | ||
download_file(v) | ||
} | ||
|
||
const versionComponents = vers?.map(v => ( | ||
<Menu.Item key={v.id} onClick={() => onClick(v)}> | ||
Version {v.number} - {v.short_description} | ||
</Menu.Item> | ||
)) | ||
|
||
return ( | ||
<Menu> | ||
<Menu.Target> | ||
<Tooltip label="Download" withArrow> | ||
<ActionIcon size={"lg"} variant="default"> | ||
<IconDownload stroke={1.4} /> | ||
</ActionIcon> | ||
</Tooltip> | ||
</Menu.Target> | ||
<Menu.Dropdown>{versionComponents}</Menu.Dropdown> | ||
</Menu> | ||
) | ||
} |
Empty file.
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