diff --git a/frontend/app/src/App.css b/frontend/app/src/App.css index 28e9f35..bdb1d95 100644 --- a/frontend/app/src/App.css +++ b/frontend/app/src/App.css @@ -1,9 +1,14 @@ +::selection { + background: #00d8a4; + color: white; +} + body { margin: 0; color: #fff; font-family: "Comfortaa", sans-serif; background-image: linear-gradient(to bottom, #020917, #101725); - background-color: #001529 + background-color: #001529; } .content { diff --git a/frontend/app/src/components/HeaderComponent.tsx b/frontend/app/src/components/HeaderComponent.tsx index 425f772..2a6e7e8 100644 --- a/frontend/app/src/components/HeaderComponent.tsx +++ b/frontend/app/src/components/HeaderComponent.tsx @@ -26,6 +26,13 @@ const HeaderComponent = () => { const [authModalOpen, setAuthModalOpen] = useState(false); const [drawerOpen, setDrawerOpen] = useState(false); + // const [screenOrientation, setScreenOrientation] = useState( + // window.screen.orientation.type + // ); + + // window.addEventListener("orientationchange", () => + // setScreenOrientation(window.screen.orientation.type) + // ); const currentLanguage = useSelector( (state: StorePrototype) => state.settings.language @@ -156,7 +163,11 @@ const HeaderComponent = () => { { + const messageApi = useContext(MessageContext); + const navigate = useNavigate(); + + const [form] = Form.useForm(); + const [createQueue, { isLoading }] = useCreateQueueMutation(); + + const submit = (formData: CreateQueueRequest) => { + createQueue(formData) + .unwrap() + .then((data: Queue) => navigate(`/dashboard/queue/${data.id}`)) + .then(() => messageApi.success(tr("Queue created"))) + .catch(() => messageApi.error(tr("Failed to create queue"))); + }; + + return ( +
+ + {tr("New queue")} +
submit(formData)} + > + + + + + + + +
+
+
+ ); +}; +export default CreateQueueCard; diff --git a/frontend/app/src/components/queue/QueuesList.tsx b/frontend/app/src/components/queue/QueuesList.tsx index fd0382d..4a1a741 100644 --- a/frontend/app/src/components/queue/QueuesList.tsx +++ b/frontend/app/src/components/queue/QueuesList.tsx @@ -9,6 +9,7 @@ import { } from "@ant-design/icons"; import Title from "antd/es/typography/Title"; import tr from "../../config/translation"; +import { Link } from "react-router-dom"; type Queue = { id: string; @@ -19,13 +20,15 @@ const QueuesList = (): JSX.Element => { const { data, isLoading } = useGetQueuesQuery({}); return (
- + + + {tr("My queues")} } diff --git a/frontend/app/src/components/styles.css b/frontend/app/src/components/styles.css index f81aaad..8e04c61 100644 --- a/frontend/app/src/components/styles.css +++ b/frontend/app/src/components/styles.css @@ -42,7 +42,6 @@ flex-flow: row; justify-content: space-between; align-items: flex-start; - width: 100%; margin-top: 1rem; margin-bottom: 1rem; } diff --git a/frontend/app/src/config/style.ts b/frontend/app/src/config/style.ts index eef6e1c..f425cff 100644 --- a/frontend/app/src/config/style.ts +++ b/frontend/app/src/config/style.ts @@ -11,4 +11,9 @@ export const theme: ThemeConfig = { borderRadius: 5, fontFamily: "Comfortaa", }, + components: { + Input: { + activeBorderColor: "#001529", + }, + }, }; diff --git a/frontend/app/src/pages/AppRoutes.tsx b/frontend/app/src/pages/AppRoutes.tsx index d561f96..ff13032 100644 --- a/frontend/app/src/pages/AppRoutes.tsx +++ b/frontend/app/src/pages/AppRoutes.tsx @@ -11,6 +11,8 @@ import DashboardPage from "./DashboardPage"; import PropTypes from "prop-types"; import { useSelector } from "react-redux"; import NotFoundPage from "./NotFoundPage"; +import CreateQueueCard from "../components/queue/CreateQueueCard"; +import NewQueuePage from "./NewQueuePage"; const AppRoutes = ({ children }: { children: ReactNode }) => { store.dispatch(getLocalToken()); @@ -22,6 +24,7 @@ const AppRoutes = ({ children }: { children: ReactNode }) => { } /> } /> + } /> } /> diff --git a/frontend/app/src/pages/MainPage.tsx b/frontend/app/src/pages/MainPage.tsx index 1fe85ff..09d8be2 100644 --- a/frontend/app/src/pages/MainPage.tsx +++ b/frontend/app/src/pages/MainPage.tsx @@ -3,6 +3,7 @@ import "./styles.css"; import logo from "../../static/logo-full.png"; import { Button } from "antd"; import tr from "../config/translation"; +import { isMobile } from "react-device-detect"; const MainPage = () => { return ( @@ -13,7 +14,9 @@ const MainPage = () => {

-
+ {!( + isMobile && window.screen.orientation.type === "portrait-primary" + ) &&
}
diff --git a/frontend/app/src/pages/NewQueuePage.tsx b/frontend/app/src/pages/NewQueuePage.tsx new file mode 100644 index 0000000..a0e1ce6 --- /dev/null +++ b/frontend/app/src/pages/NewQueuePage.tsx @@ -0,0 +1,18 @@ +import React from "react"; +import "./styles.css"; +import { useSelector } from "react-redux"; +import { StorePrototype } from "../config/store"; +import tr from "../config/translation"; +import Title from "antd/es/typography/Title"; +import CreateQueueCard from "../components/queue/CreateQueueCard"; + +const NewQueuePage = () => { + const user = useSelector((state: StorePrototype) => state.auth.user); + return user ? ( + + ) : ( + {tr("Log in first")} + ); +}; + +export default NewQueuePage; diff --git a/frontend/app/src/pages/styles.css b/frontend/app/src/pages/styles.css index 505d457..225c767 100644 --- a/frontend/app/src/pages/styles.css +++ b/frontend/app/src/pages/styles.css @@ -1,46 +1,45 @@ - @keyframes cardPopup { - 0% { - transform: translateY(20%); - opacity: 0%; - } - 50% { - transform: translateY(3%); - } - 100% { - transform: translateY(0); - opacity: 100%; - } + 0% { + transform: translateY(20%); + opacity: 0%; } + 50% { + transform: translateY(3%); + } + 100% { + transform: translateY(0); + opacity: 100%; + } +} .card { - animation: 0.5s ease-out 0s 1 cardPopup; - background: #001529; - margin-top: 0.5rem; - margin-right: 1rem; - margin-left: 1rem; - border-radius: 10px; - } + animation: 0.5s ease-out 0s 1 cardPopup; + background: #001529; + margin-top: 0.5rem; + margin-right: 1rem; + margin-left: 1rem; + border-radius: 10px; +} .main { - font-family: "Comfortaa", sans-serif; - padding: 3rem; - display: flex; - flex-flow: column; - justify-items: center; - align-items: center; - align-content: space-between; + user-select: none; + padding: 3rem; + display: flex; + flex-flow: column; + justify-items: center; + align-items: center; + align-content: space-between; } .image { - height: 100px; - width: auto; + height: 100px; + width: auto; } .button-box { - width: 100%; - display: flex; - justify-content: center; - align-items: center; - flex-wrap: wrap; -} \ No newline at end of file + width: 100%; + display: flex; + justify-content: center; + align-items: center; + flex-wrap: wrap; +} diff --git a/frontend/app/src/slice/QueueApi.ts b/frontend/app/src/slice/QueueApi.ts index 4128ca1..b3d2813 100644 --- a/frontend/app/src/slice/QueueApi.ts +++ b/frontend/app/src/slice/QueueApi.ts @@ -7,6 +7,12 @@ export type CreateQueueRequest = { description: string | null; }; +export type Queue = { + id: string; + name: string; + description: string | null; +}; + export const QueueApi = createApi({ reducerPath: "QueueApi", baseQuery: fetchBaseQuery({