This commit is contained in:
2024-08-02 19:13:13 +05:00
parent 6e4401219e
commit 19bf521825
8 changed files with 68 additions and 27 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
# VITE_API_URL=http://localhost:3001
VITE_API_URL=http://localhost:3001
# VITE_API_URL=http://192.168.1.171:3001
VITE_API_URL=https://crm.stream.graff.tech/api
# VITE_API_URL=https://crm.stream.graff.tech/api
VITE_STREAM_URL=https://stream.graff.tech
+11 -7
View File
@@ -1,11 +1,13 @@
import {
addMonths,
format,
getDay,
getDaysInMonth,
getISODay,
isSameDay,
isToday,
setDate,
startOfDay,
startOfMonth,
subMonths,
} from "date-fns";
import { useState } from "react";
@@ -22,7 +24,9 @@ import useStore from "../stores/useStore";
function Calendar() {
const { selectedDay, setSelectedDay } = useStore();
const { isShowCalendar, setIsShowCalendar } = useSettingsStore();
const [currentMonth, setCurrentMonth] = useState<Date>(new Date());
const [currentMonth, setCurrentMonth] = useState<Date>(
startOfMonth(startOfDay(new Date()))
);
function selectPrevMonth() {
setCurrentMonth(subMonths(currentMonth, 1));
@@ -74,11 +78,11 @@ function Calendar() {
))}
</div>
<div className="grid grid-cols-7 gap-2">
{Array.from({ length: getISODay(currentMonth) - 1 }).map(
(_, index) => (
<div key={index} className="w-8 h-8"></div>
)
)}
{Array.from({
length: getDay(startOfDay(startOfMonth(currentMonth))) - 1,
}).map((_, index) => (
<div key={index} className="w-8 h-8"></div>
))}
{Array.from({ length: getDaysInMonth(currentMonth) }).map(
(_, index) => (
<button
+5 -2
View File
@@ -9,7 +9,7 @@ import { Link } from "react-router-dom";
import IUser from "../types/IUser";
import useAuthStore from "../stores/useAuthStore";
import EntryIcon from "./icons/EntryIcon";
import { isAfter } from "date-fns";
import { isAfter, subMinutes } from "date-fns";
interface CardProps {
companyId: string;
@@ -112,7 +112,10 @@ function Card({
<div className="flex gap-2">
{user?.role === "manager" &&
(manager ? (
isAfter(new Date(), new Date(scheduleSessionStartAt)) ? (
isAfter(
new Date(),
subMinutes(new Date(scheduleSessionStartAt), 10)
) ? (
<Link
to={`${
import.meta.env.VITE_STREAM_URL