sessions search

This commit is contained in:
2025-06-10 15:14:40 +05:00
parent 538e2b67bc
commit ec6d05f4cf
27 changed files with 203 additions and 66 deletions
+7 -7
View File
@@ -1,9 +1,9 @@
import { IServer } from "../../types/IServer.ts";
import { Server } from "../../types/IServer.ts";
import { useEffect, useRef, useState } from "react";
import { IApp } from "../../types/IApp.ts";
import api from "../../utils/api.ts";
import { ISession } from "../../types/ISession.ts";
import { IClient } from "../../types/IClient.ts";
import { Session } from "../../types/ISession.ts";
import { Client } from "../../types/IClient.ts";
import useModalStore from "../../stores/useModalStore.ts";
import TableSelector from "../TableSelector.tsx";
import NewInput from "../NewInput.tsx";
@@ -27,7 +27,7 @@ export default function CreateSessionModal({ targetServerId }: Props) {
const { data: servers } = useQuery({
queryKey: ["servers"],
queryFn: () => api.get("servers?withLastSession=true").json<IServer[]>(),
queryFn: () => api.get("servers?withLastSession=true").json<Server[]>(),
refetchInterval: 1000,
});
@@ -35,7 +35,7 @@ export default function CreateSessionModal({ targetServerId }: Props) {
? servers?.find((server) => server.id === targetServerId) || null
: null;
const [selectedServer, setSelectedServer] = useState<IServer | null>(
const [selectedServer, setSelectedServer] = useState<Server | null>(
targetServer
);
const [selectedApp, setSelectedApp] = useState<IApp | null>(null);
@@ -56,7 +56,7 @@ export default function CreateSessionModal({ targetServerId }: Props) {
email,
},
})
.json<IClient>();
.json<Client>();
},
});
@@ -79,7 +79,7 @@ export default function CreateSessionModal({ targetServerId }: Props) {
appId,
},
})
.json<ISession>(),
.json<Session>(),
onMutate: () => {
queryClient.invalidateQueries({ queryKey: ["sessions"] });
queryClient.invalidateQueries({ queryKey: ["servers"] });
@@ -5,10 +5,10 @@ import ChevronRightIcon from "../icons/ChevronRightIcon";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import api from "../../utils/api";
import useModalStore from "../../stores/useModalStore";
import { ISession } from "../../types/ISession";
import { Session } from "../../types/ISession";
import { useEffect, useState } from "react";
function CurrentSessionModal({ session }: { session: ISession }) {
function CurrentSessionModal({ session }: { session: Session }) {
const queryClient = useQueryClient();
const { setModal } = useModalStore();
@@ -86,7 +86,7 @@ function CurrentSessionModal({ session }: { session: ISession }) {
<NewButton variant="secondary" className="w-full">
<div className="flex flex-col gap-[0.278vw] w-full text-left h-[2.222vw]">
<p className="caption-s font-medium text-[#BDBDBD]">Клиент</p>
<p className="text-s font-medium">{session.client.name}</p>
<p className="text-s font-medium">{session.client.fullname}</p>
</div>
<div className="flex gap-[0.556vw] items-center">
{!session.client.email && (
+2 -2
View File
@@ -2,12 +2,12 @@ import { useState } from "react";
import NewInput from "../NewInput";
import NewButton from "../NewButton";
import useModalStore from "../../stores/useModalStore";
import { IServer } from "../../types/IServer";
import { Server } from "../../types/IServer";
import { useQueryClient } from "@tanstack/react-query";
import { useMutation } from "@tanstack/react-query";
import api from "../../utils/api";
function EditTable({ table }: { table: IServer }) {
function EditTable({ table }: { table: Server }) {
const [tableName, setTableName] = useState(table.name);
const [tableDescription, setTableDescription] = useState(table.location);
const { setModal } = useModalStore();
+2 -2
View File
@@ -1,4 +1,4 @@
import { ISession } from "../../types/ISession";
import { Session } from "../../types/ISession";
import { format } from "date-fns";
import { ru } from "date-fns/locale";
import getIntervalDuration from "../../utils/interval-duration";
@@ -11,7 +11,7 @@ import DownloadIcon from "../icons/DownloadIcon";
import ShareIcon from "../icons/ShareIcon";
import SessionComments from "../SessionComments";
function SessionModal({ session }: { session: ISession }) {
function SessionModal({ session }: { session: Session }) {
return (
<div className="bg-[#FFFFFF] w-[49.722vw] rounded-4xl">
<div className="w-full flex justify-center items-center h-[4.861vw]">