Skip to content

Commit

Permalink
Merge branch 'master' into frontend-release
Browse files Browse the repository at this point in the history
  • Loading branch information
ndepaola committed Mar 6, 2024
2 parents 510b633 + 315a60f commit 87af3af
Show file tree
Hide file tree
Showing 9 changed files with 340 additions and 26 deletions.
4 changes: 3 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Provide an overview of your PR here.

# Checklist

- [ ] I have installed `pre-commit` and run the hooks with `pre-commit run`.
- [ ] I have installed `pre-commit` and installed the hooks with `pre-commit install` before creating any commits.
- [ ] I have updated any related tests for code I modified or added new tests where appropriate.
- [ ] I have manually tested my changes as follows:
- <!-- Insert your manual testing steps here. -->
- [ ] I have updated any relevant documentation or created new documentation where appropriate.
51 changes: 45 additions & 6 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions frontend/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { SelectedImagesRibbon } from "@/features/bulkManagement/bulkManagementRi
import { CardGrid } from "@/features/card/cardGrid";
import { CommonCardback } from "@/features/card/commonCardback";
import { Export } from "@/features/export/export";
import { FinishedMyProject } from "@/features/export/finishedMyProjectModal";
import { FinishSettings } from "@/features/finishSettings/finishSettings";
import { Import } from "@/features/import/import";
import {
Expand Down Expand Up @@ -98,15 +99,16 @@ function App() {
<Row className="g-0 pt-2">
<SearchSettings />
</Row>
<Row className="g-0 py-2">
<Col lg={6} md={12} sm={12} xs={12}>
<Row className="g-0 pt-2">
<Col lg={7} md={12} sm={12} xs={12}>
<Import />
</Col>
<Col lg={6} md={12} sm={12} xs={12}>
<Col lg={5} md={12} sm={12} xs={12}>
<Export />
</Col>
<FinishedMyProject />
</Row>
<Col className="g-0" lg={{ span: 8, offset: 2 }} md={12}>
<Col className="g-0 pt-2" lg={{ span: 8, offset: 2 }} md={12}>
<CommonCardback selectedImage={cardback} />
</Col>
</OverflowCol>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ export type Modals =
| "changeQuery"
| "supportDeveloper"
| "supportBackend"
| "invalidIdentifiers";
| "invalidIdentifiers"
| "finishedMyProject";

export interface ModalsState {
card: CardDocument | null;
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/features/export/export.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ export function Export() {
return (
<Dropdown>
<div className="d-grid gap-0">
<Dropdown.Toggle variant="success" id="dropdown-basic">
<Dropdown.Toggle variant="secondary" id="dropdown-basic">
<RightPaddedIcon bootstrapIconName="cloud-arrow-down" /> Download
</Dropdown.Toggle>
</div>
<Dropdown.Menu>
<ExportDecklist />
<ExportXML />
<ExportImages />
<ExportDecklist />
</Dropdown.Menu>
</Dropdown>
);
Expand Down
18 changes: 7 additions & 11 deletions frontend/src/features/export/exportXML.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,30 +207,26 @@ export function generateXML(
return formatXML(xml, { collapseContent: true });
}

export function ExportXML() {
//# region queries and hooks

export function useExportXML() {
const store = useStore();
const isProjectEmpty = useAppSelector(selectIsProjectEmpty);

//# endregion

//# region callbacks

const downloadFile = () => {
return () => {
const generatedXML = selectGeneratedXML(store.getState() as RootState);
saveAs(
new Blob([generatedXML], { type: "text/xml;charset=utf-8" }),
"cards.xml"
);
};
}

//# endregion
export function ExportXML() {
const exportXML = useExportXML();
const isProjectEmpty = useAppSelector(selectIsProjectEmpty);

return (
<Dropdown.Item
disabled={isProjectEmpty}
onClick={downloadFile}
onClick={exportXML}
data-testid="export-xml-button"
>
<RightPaddedIcon bootstrapIconName="file-code" /> XML
Expand Down
Loading

0 comments on commit 87af3af

Please sign in to comment.