diff --git a/ui/components/clipboard_copy.tsx b/ui/components/clipboard_copy.tsx
new file mode 100644
index 0000000..4bf51d2
--- /dev/null
+++ b/ui/components/clipboard_copy.tsx
@@ -0,0 +1,32 @@
+import { CheckOutlined, CopyOutlined } from "@ant-design/icons";
+import { Button, Flex, Input, Typography } from "antd";
+import { useEffect, useState } from "react";
+
+
+
+
+
+export function CopyToClipboard(props: { text: string, onCopy: () => void, size?: number }) {
+ const [is_copied, setIsCopied] = useState(false);
+
+ const copyToClipboard = () => {
+ navigator.clipboard.writeText(props.text).then(() => {
+ props.onCopy();
+ setIsCopied(true);
+ });
+ }
+
+ let button_icon = ;
+ if (is_copied) {
+ button_icon = ;
+ }
+
+
+ return (
+
+ {props.text}
+
+
+ )
+
+}
\ No newline at end of file
diff --git a/ui/components/create_budget_form.tsx b/ui/components/create_budget_form.tsx
index 6bdf51f..7d418eb 100644
--- a/ui/components/create_budget_form.tsx
+++ b/ui/components/create_budget_form.tsx
@@ -23,27 +23,38 @@ import React from "react";
import { DataService, getDataService } from "../services/data_service";
import { navigate, store, View } from "../store";
-import { CloseCircleOutlined, CloseOutlined, CloseSquareFilled, LoadingOutlined, RightOutlined } from "@ant-design/icons";
+import { CloseCircleOutlined, CloseOutlined, CloseSquareFilled, LinkOutlined, LoadingOutlined, RightOutlined } from "@ant-design/icons";
import { Budget, Category, DataModelFactory } from "../datamodel/datamodel";
import { connect } from "react-redux";
+import { LinkBudgetModal } from "./link_budget_modal";
export interface CreateBudgetFormProps {
onFinish: (budget: Budget) => void;
onCancel?: () => void;
}
-class CreateBudgetForm extends React.Component {
+export interface CreateBudgetFormState {
+ is_link_modal_open: boolean;
+}
+
+class CreateBudgetForm extends React.Component {
data_service: DataService;
constructor(props: CreateBudgetFormProps) {
super(props);
this.data_service = getDataService();
+ this.state = {
+ is_link_modal_open: false
+ };
}
render() {
return (
<>
{this.render_create_budget()}
+ this.setState({ is_link_modal_open: false })}
+ onDone={() => store.dispatch(navigate(View.Overview))} />
>
);
}
@@ -54,7 +65,6 @@ class CreateBudgetForm extends React.Component {
description?: string;
};
const onFinish: FormProps['onFinish'] = (values) => {
- this.setState({ is_loading: true });
this.data_service.createBudget(values.name!).then((value: Budget) => {
this.props.onFinish(value);
}).catch((error) => {
@@ -94,6 +104,11 @@ class CreateBudgetForm extends React.Component {
Next
+
+ } onClick={()=>{this.setState({is_link_modal_open:true})}}>
+ Add Existing Budget
+
+
{render_cancel_button()}
);