Skip to content

Commit

Permalink
removed unused code and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bambooch committed Oct 28, 2024
1 parent fe2abe0 commit 55ab07e
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 33 deletions.
6 changes: 1 addition & 5 deletions frontend/src/app/components/DateSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
'use client';

import React from 'react';
import { CalendarIcon } from '@radix-ui/react-icons';
import { format } from 'date-fns';
import { cn } from '@/lib/utils';
import { Button } from '@/components/ui/button';
import { Calendar } from '@/components/ui/calendar';
import { Calendar } from './ui/calendar';
import dayjs from 'dayjs';

interface DateSelectorProps {
Expand Down
9 changes: 3 additions & 6 deletions frontend/src/app/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ const Footer: React.FC = () => {
</a>
</p>
<Dialog>
<DialogTrigger className="bg-indigo-400 text-white p-2 mt-2 rounded-lg">Prijavite problem / Predložite
funkciju</DialogTrigger>
<DialogTrigger className="bg-indigo-400 text-white p-2 mt-2 rounded-lg">Prijavite problem / Predložite funkciju</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Prijavite problem / Predložite funkciju</DialogTitle>
Expand All @@ -141,8 +140,7 @@ const Footer: React.FC = () => {
name="contactInfo"
render={({field}) => (
<FormItem>
<FormLabel className="text-sm text-white font-semibold">Kontakt informacije (Nije
obavezno)</FormLabel>
<FormLabel className="text-sm text-white font-semibold">Kontakt informacije (Nije obavezno)</FormLabel>
<Input
placeholder="E-pošta ili telefon (Nije obavezno)" {...field}
/>
Expand Down Expand Up @@ -180,8 +178,7 @@ const Footer: React.FC = () => {
<DialogClose asChild>
<Button className="bg-red-600 hover:bg-red-500 text-white font-semibold">Zatvori</Button>
</DialogClose>
<Button type="submit"
className="bg-indigo-500 hover:bg-indigo-400 text-white font-semibold">Pošalji</Button>
<Button type="submit" className="bg-indigo-500 hover:bg-indigo-400 text-white font-semibold">Pošalji</Button>
</div>
</form>
</Form>
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/app/components/StationSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ interface StationSelectProps {
selectedStation: string | null;
setSelectedStation: (stationId: string | null) => void;
placeholder: string;
onStationChange?: (stationId: string | null) => void; // New callback prop
onStationChange?: (stationId: string | null) => void;
}

const StationSelect: React.FC<StationSelectProps> = ({
stations,
selectedStation,
setSelectedStation,
placeholder,
onStationChange, // Receive the callback prop
onStationChange,
}) => {
const [open, setOpen] = React.useState(false);

Expand All @@ -39,7 +39,6 @@ const StationSelect: React.FC<StationSelectProps> = ({
const callbackValue = comboBoxSelection._id ? comboBoxSelection._id : null;
setSelectedStation(callbackValue);

// Call onStationChange if it's provided
if (onStationChange) {
onStationChange(callbackValue);
}
Expand Down
11 changes: 5 additions & 6 deletions frontend/src/app/components/ui/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@ import InfoIcon from '@mui/icons-material/Info';

function Notification({ message = "Notification", color = 'gray', icon: Icon = InfoIcon }) {
const [isVisible, setIsVisible] = useState(false);
const duration = 3000; // Static duration of 3 seconds
const dynamicColorClass = `bg-${color}-400`;
const duration = 3000;

useEffect(() => {
setIsVisible(true); // Show notification when component mounts
setIsVisible(true);
const timer = setTimeout(() => {
setIsVisible(false); // Auto-hide after the duration
setIsVisible(false);
}, duration);
return () => clearTimeout(timer); // Clear timer if component unmounts
return () => clearTimeout(timer);
}, []);

return (
<div
className={`fixed top-12 sm:right-5 py-2 px-3 rounded transition-transform duration-500 ease-out flex items-center gap-2 ${
isVisible ? 'transform translate-y-0 sm:translate-x-0 opacity-100' : 'transform translate-y-full sm:translate-y-0 sm:translate-x-full opacity-0'
} bg-red-400`} // Use the dynamically constructed class
} bg-red-400`}
>
{Icon && <Icon className="text-white w-5 h-5"/>}
<div className="text-white">{message}</div>
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/app/components/ui/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ function Calendar({
showOutsideDays={showOutsideDays}
className={cn("mr-0 sm:mr-20", className)}
classNames={{
months: "", // Flexbox for months
month: "flex flex-col space-y-6", // Stack months vertically
months: "",
month: "flex flex-col space-y-6",
caption: "flex justify-center pt-1 relative items-center",
caption_label: "text-xl text-neutral-500 font-medium",
nav: "space-x-1 flex items-center",
Expand All @@ -30,22 +30,22 @@ function Calendar({
nav_button_previous: "absolute left-1 bg-gray-500 text-white",
nav_button_next: "absolute right-1 bg-gray-500 text-white",
table: "w-full border-collapse",
head_row: "flex justify-between", // Flex layout for head row
head_row: "flex justify-between",
head_cell: cn(
"text-muted-foreground ml-1.5 font-medium text-center text-[0.8rem]",
"flex-1" // Each head cell takes equal space
"flex-1"
),
row: "flex justify-between w-full", // Flex layout for rows
row: "flex justify-between w-full",
cell: cn(
"relative p-1 text-center text-sm focus-within:relative focus-within:z-20",
props.mode === "range"
? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md"
: "[&:has([aria-selected])]:rounded-md",
"flex-1 aspect-square sm:h-24 sm:w-24 h-12 w-12" // Larger size on desktop
"flex-1 aspect-square sm:h-24 sm:w-24 h-12 w-12"
),
day: cn(
buttonVariants({ variant: "ghost" }),
"flex items-center justify-center w-full h-full bg-white font-normal" // Use full width/height
"flex items-center justify-center w-full h-full bg-white font-normal"
),
day_range_start: "day-range-start",
day_range_end: "day-range-end",
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import RouteService from "./services/route.service";
import StationService from "./services/station.service";
import FilterService from "./handlers/route.filter.handler";
import { toSortedStationsAlphabetically } from "@/lib/utils";
import { Calendar } from "@/components/ui/calendar"
import StationSelect from "@/components/StationSelect";
import Modal from "@/components/ui/modal";
import SportsEsportsIcon from '@mui/icons-material/SportsEsports';
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/routes/RouteSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const RouteSearch: React.FC<RouteSearchProps> = ({
<div className=''>
<DateSelector
dateOfDeparture={dateOfDeparture}
onDateChange={handleDateChange} // Use the updated handler
onDateChange={handleDateChange}
/>
</div>
{error && (
Expand Down
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 55ab07e

Please sign in to comment.