1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-22 14:44:21 +00:00

Move contexts inside components

This commit is contained in:
Steffo 2022-06-08 17:38:30 +02:00
parent 24c1ba8f54
commit dcf8e8e29c
Signed by: steffo
GPG key ID: 6965406171929D01
14 changed files with 17 additions and 17 deletions

View file

@ -2,7 +2,7 @@ import { default as axios, AxiosError } from "axios"
import { default as classNames } from "classnames" import { default as classNames } from "classnames"
import { useTranslation } from "next-i18next" import { useTranslation } from "next-i18next"
import { HTMLProps, useCallback, useState } from "react" import { HTMLProps, useCallback, useState } from "react"
import { LoginContext } from "../contexts/login" import { LoginContext } from "./contexts/login"
import { ApiError, ApiResult } from "../types/api" import { ApiError, ApiResult } from "../types/api"
import { FestaLoginData, TelegramLoginData } from "../types/user" import { FestaLoginData, TelegramLoginData } from "../types/user"
import { useDefinedContext } from "../utils/definedContext" import { useDefinedContext } from "../utils/definedContext"

View file

@ -1,5 +1,5 @@
import { useTranslation } from "next-i18next" import { useTranslation } from "next-i18next"
import { LoginContext } from "../contexts/login" import { LoginContext } from "./contexts/login"
import { useDefinedContext } from "../utils/definedContext" import { useDefinedContext } from "../utils/definedContext"
export function LogoutLink() { export function LogoutLink() {

View file

@ -0,0 +1,4 @@
import { createStateContext } from "../../utils/stateContext";
export const EditingContext = createStateContext<boolean>()

View file

@ -1,5 +1,5 @@
import { FestaLoginData } from "../types/user"; import { FestaLoginData } from "../../types/user";
import { createStateContext } from "../utils/stateContext"; import { createStateContext } from "../../utils/stateContext";
/** /**

View file

@ -1,6 +1,6 @@
import { faChevronRight, faClock } from "@fortawesome/free-solid-svg-icons" import { faChevronRight, faClock } from "@fortawesome/free-solid-svg-icons"
import { HTMLProps } from "react" import { HTMLProps } from "react"
import { EditingContext } from "../../contexts/editing" import { EditingContext } from "../contexts/editing"
import { useDefinedContext } from "../../utils/definedContext" import { useDefinedContext } from "../../utils/definedContext"
import { FestaIcon } from "../extensions/FestaIcon" import { FestaIcon } from "../extensions/FestaIcon"
import { FormDateRange } from "../form/FormDateRange" import { FormDateRange } from "../form/FormDateRange"

View file

@ -1,5 +1,5 @@
import { HTMLProps } from "react"; import { HTMLProps } from "react";
import { EditingContext } from "../../contexts/editing"; import { EditingContext } from "../contexts/editing";
import { useDefinedContext } from "../../utils/definedContext"; import { useDefinedContext } from "../../utils/definedContext";
import { FestaMarkdown } from "../extensions/FestaMarkdown"; import { FestaMarkdown } from "../extensions/FestaMarkdown";

View file

@ -1,5 +1,5 @@
import { HTMLProps } from "react"; import { HTMLProps } from "react";
import { EditingContext } from "../../contexts/editing"; import { EditingContext } from "../contexts/editing";
import { useDefinedContext } from "../../utils/definedContext"; import { useDefinedContext } from "../../utils/definedContext";
import { Postcard } from "../postcard/Postcard"; import { Postcard } from "../postcard/Postcard";

View file

@ -1,5 +1,5 @@
import { HTMLProps } from "react"; import { HTMLProps } from "react";
import { EditingContext } from "../../contexts/editing"; import { EditingContext } from "../contexts/editing";
import { useDefinedContext } from "../../utils/definedContext"; import { useDefinedContext } from "../../utils/definedContext";

View file

@ -1,6 +1,6 @@
import { faBinoculars, faPencil } from "@fortawesome/free-solid-svg-icons" import { faBinoculars, faPencil } from "@fortawesome/free-solid-svg-icons"
import { useTranslation } from "next-i18next" import { useTranslation } from "next-i18next"
import { EditingContext } from "../../contexts/editing" import { EditingContext } from "../contexts/editing"
import { useDefinedContext } from "../../utils/definedContext" import { useDefinedContext } from "../../utils/definedContext"
import { FestaIcon } from "../extensions/FestaIcon" import { FestaIcon } from "../extensions/FestaIcon"

View file

@ -1,4 +0,0 @@
import { createStateContext } from "../utils/stateContext";
export const EditingContext = createStateContext<boolean>()

View file

@ -1,6 +1,6 @@
import { AxiosInstance, AxiosRequestConfig, default as axios } from "axios"; import { AxiosInstance, AxiosRequestConfig, default as axios } from "axios";
import { useContext, useMemo } from "react"; import { useContext, useMemo } from "react";
import { LoginContext } from "../contexts/login"; import { LoginContext } from "../components/contexts/login";
import { FestaLoginData } from "../types/user"; import { FestaLoginData } from "../types/user";
export function useAxios<D>(config: AxiosRequestConfig<D> = {}, data?: FestaLoginData | null): AxiosInstance { export function useAxios<D>(config: AxiosRequestConfig<D> = {}, data?: FestaLoginData | null): AxiosInstance {

View file

@ -1,6 +1,6 @@
import '../styles/globals.css' import '../styles/globals.css'
import type { AppProps } from 'next/app' import type { AppProps } from 'next/app'
import { LoginContext } from '../contexts/login' import { LoginContext } from '../components/contexts/login'
import { useState } from 'react' import { useState } from 'react'
import defaultPostcard from "../public/postcards/adi-goldstein-Hli3R6LKibo-unsplash.jpg" import defaultPostcard from "../public/postcards/adi-goldstein-Hli3R6LKibo-unsplash.jpg"
import { PostcardRenderer } from '../components/postcard/PostcardRenderer' import { PostcardRenderer } from '../components/postcard/PostcardRenderer'

View file

@ -8,7 +8,7 @@ import { ToolBar } from "../../components/tools/ToolBar";
import { EditableMarkdown } from "../../components/editable/EditableMarkdown"; import { EditableMarkdown } from "../../components/editable/EditableMarkdown";
import { EditableText } from "../../components/editable/EditableText"; import { EditableText } from "../../components/editable/EditableText";
import { ToolToggleEditing } from "../../components/tools/ToolToggleEditing"; import { ToolToggleEditing } from "../../components/tools/ToolToggleEditing";
import { EditingContext } from "../../contexts/editing"; import { EditingContext } from "../../components/contexts/editing";
import { database } from "../../utils/prismaClient"; import { database } from "../../utils/prismaClient";
import { EditablePostcard } from "../../components/editable/EditablePostcard"; import { EditablePostcard } from "../../components/editable/EditablePostcard";
import { ViewEvent } from "../../components/view/ViewEvent"; import { ViewEvent } from "../../components/view/ViewEvent";

View file

@ -1,7 +1,7 @@
import { NextPageContext } from 'next' import { NextPageContext } from 'next'
import { useTranslation } from 'next-i18next' import { useTranslation } from 'next-i18next'
import { serverSideTranslations } from 'next-i18next/serverSideTranslations' import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import { LoginContext } from '../contexts/login' import { LoginContext } from '../components/contexts/login'
import { useDefinedContext } from '../utils/definedContext' import { useDefinedContext } from '../utils/definedContext'
import { ActionLoginTelegram } from '../components/ActionLoginTelegram' import { ActionLoginTelegram } from '../components/ActionLoginTelegram'
import { ActionEventList } from '../components/ActionEventList' import { ActionEventList } from '../components/ActionEventList'