Skip to content

Commit

Permalink
demo screen width hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
diego-escobedo committed Jan 11, 2023
1 parent 92754bf commit 60d49e0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
30 changes: 15 additions & 15 deletions backend/metering_billing/demos.py
Original file line number Diff line number Diff line change
Expand Up @@ -1157,21 +1157,21 @@ def setup_demo4(
end_time = time.time()
print("Time to generate 1 month data: ", end_time - start_time)
now = now_utc()
backtest = Backtest.objects.create(
backtest_name=organization,
start_date="2022-08-01",
end_date="2022-11-01",
organization=organization,
time_created=now,
kpis=[BACKTEST_KPI.TOTAL_REVENUE],
)
BacktestSubstitution.objects.create(
backtest=backtest,
original_plan=bp_pro_both,
new_plan=bp_experimental,
organization=organization,
)
run_backtest.delay(backtest.backtest_id)
# backtest = Backtest.objects.create(
# backtest_name=organization,
# start_date="2022-08-01",
# end_date="2022-11-01",
# organization=organization,
# time_created=now,
# kpis=[BACKTEST_KPI.TOTAL_REVENUE],
# )
# BacktestSubstitution.objects.create(
# backtest=backtest,
# original_plan=bp_pro_both,
# new_plan=bp_experimental,
# organization=organization,
# )
# run_backtest.delay(backtest.backtest_id)
return user


Expand Down
17 changes: 14 additions & 3 deletions frontend/src/pages/DemoSignup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import LoadingSpinner from "../components/LoadingSpinner";
import { instance } from "../api/api";
import Cookies from "universal-cookie";
import { toast } from "react-toastify";
import { useEffect } from "react";

const cookies = new Cookies();

// import sjcl from "sjcl";

export interface DemoSignupProps {
username: string;
email: string;
Expand All @@ -34,6 +33,7 @@ const DemoSignup: React.FC = () => {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [form] = Form.useForm();
const [timeOutId, setTimeOutId] = useState<number | undefined>();

const queryClient = useQueryClient();
const next = () => {
Expand Down Expand Up @@ -62,6 +62,7 @@ const DemoSignup: React.FC = () => {
toast.error(error.response.data.detail, {
position: "top-center",
});
navigate("/login");
},
}
);
Expand Down Expand Up @@ -92,6 +93,16 @@ const DemoSignup: React.FC = () => {
});
};

useEffect(() => {
if (mutation.isLoading) {
setTimeOutId(setTimeout(() => navigate("/login"), 15000));
}

return () => {
clearTimeout(timeOutId);
};
}, [mutation.isLoading]);

return (
<div className="grid h-screen place-items-center">
{mutation.isLoading ? (
Expand All @@ -100,7 +111,7 @@ const DemoSignup: React.FC = () => {
<LoadingSpinner />
</div>
) : (
<div className="space-y-4 w-2/12">
<div className="space-y-4 w-3/12">
<div className="">
<div>
<Card
Expand Down

0 comments on commit 60d49e0

Please sign in to comment.