Move ExportCalendarbtn
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import Button from "../ui/Button/Button";
|
||||
import { useContext } from "react";
|
||||
import { AuthContext, AuthContextType } from "../../contexts/Auth/AuthContext";
|
||||
import { APP_CONFIG } from "../../config/appConfig";
|
||||
|
||||
export default function ExportCalendarBtn() {
|
||||
|
||||
const { user } = useContext(AuthContext) as AuthContextType;
|
||||
const calendarUrl = `${import.meta.env.VITE_API_URL}/api/export/ics/${user?.id}`;
|
||||
|
||||
return <Button
|
||||
onClick={() => {
|
||||
window.open(
|
||||
`${APP_CONFIG.newCalendarURL}${calendarUrl}`
|
||||
);
|
||||
}}
|
||||
>
|
||||
Exporter
|
||||
</Button>
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
import {useState, useMemo, useEffect, useContext} from "react";
|
||||
import styles from "./Calendar.module.css";
|
||||
import {formatDateLetterJS} from "../../../../utils/date/formatDateLetter.js";
|
||||
import Button from "../../../../components/ui/Button/Button";
|
||||
import {AuthContext} from "../../../../contexts/Auth/AuthContext.ts";
|
||||
import ExportBtn from "./ExportBtn.tsx";
|
||||
import ExportBtn from "../../../../components/ExportCalendarBtn/ExportBtn.tsx";
|
||||
|
||||
function
|
||||
Calendar() {
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import Button from "../../../../components/ui/Button/Button";
|
||||
import styles from "../../HomePage.module.css"
|
||||
import { useContext } from "react";
|
||||
import { AuthContext, AuthContextType } from "../../../../contexts/Auth/AuthContext";
|
||||
import { APP_CONFIG } from "../../../../config/appConfig";
|
||||
|
||||
export default function ExportBtn() {
|
||||
|
||||
const { user } = useContext(AuthContext) as AuthContextType;
|
||||
const calendarUrl = `${import.meta.env.VITE_API_URL}/api/export/ics/${user?.id}`;
|
||||
|
||||
return <Button className={styles.exportbtn}
|
||||
onClick={() => {
|
||||
window.open(
|
||||
`${APP_CONFIG.newCalendarURL}${calendarUrl}`
|
||||
);
|
||||
}}
|
||||
>
|
||||
Exporter
|
||||
</Button>
|
||||
}
|
||||
Reference in New Issue
Block a user