diff --git a/package.json b/package.json index 44f14fa6..eb2654f9 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,6 @@ "prettier": "3.0.3", "prettier-plugin-tailwindcss": "0.5.6", "tailwindcss": "3.3.4", - "vite": "4.5.0" + "vite": "^4.5.14" } -} \ No newline at end of file +} diff --git a/public/img/background.jpg b/public/img/background.jpg new file mode 100644 index 00000000..fb14759e Binary files /dev/null and b/public/img/background.jpg differ diff --git a/public/img/pattern.png b/public/img/pattern.png deleted file mode 100644 index 2b34e46f..00000000 Binary files a/public/img/pattern.png and /dev/null differ diff --git a/src/api/axiosConfig.js b/src/api/axiosConfig.js new file mode 100644 index 00000000..727b79ee --- /dev/null +++ b/src/api/axiosConfig.js @@ -0,0 +1,28 @@ +import axios from "axios"; + + +const apiClient = axios.create({ + baseURL: "https://localhost:7093/api", +}); + + +apiClient.interceptors.request.use( + (config) => { + + const token = localStorage.getItem("authToken"); + + + if (token) { + + config.headers.Authorization = `Bearer ${token}`; + } + + return config; + }, + (error) => { + + return Promise.reject(error); + } +); + +export default apiClient; \ No newline at end of file diff --git a/src/pages/auth/index.js b/src/pages/auth/index.js index ca1bbcb6..425a5351 100644 --- a/src/pages/auth/index.js +++ b/src/pages/auth/index.js @@ -1,2 +1,2 @@ export * from "@/pages/auth/sign-in"; -export * from "@/pages/auth/sign-up"; + diff --git a/src/pages/auth/sign-in.jsx b/src/pages/auth/sign-in.jsx index 3b3da41a..e24defe7 100644 --- a/src/pages/auth/sign-in.jsx +++ b/src/pages/auth/sign-in.jsx @@ -1,126 +1,108 @@ -import { - Card, - Input, - Checkbox, - Button, - Typography, -} from "@material-tailwind/react"; -import { Link } from "react-router-dom"; - +import React, { useState } from "react"; // YENİ: useState eklendi +import { Card, Input, Button, Typography } from "@material-tailwind/react"; +import { Link, useNavigate } from "react-router-dom"; // YENİ: useNavigate eklendi export function SignIn() { + const [username, setUsername] = useState(""); + const [password, setPassword] = useState(""); + const navigate = useNavigate(); + + + const handleSignIn = async () => { + const loginData = { + username: username, + password: password, + }; + + try { + const response = await fetch("https://localhost:7093/api/Auth/Login", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(loginData), + }); + + if (response.ok) { + const token = await response.text(); + + + localStorage.setItem("authToken", token); + console.log("Giriş Başarılı!"); + navigate("/dashboard/home"); + } else { + alert("Kullanıcı adı veya şifre hatalı!"); + } + } catch (error) { + console.error("Sunucuya bağlanırken bir hata oluştu:", error); + alert("Sunucuya bağlanılamadı."); + } + }; + return ( -
-
-
- Sign In - Enter your email and password to Sign In. -
-
-
- - Your email - - - - Password +
+ +
+ + LOGO -
- +
- I agree the  - - Terms and Conditions - + Kullanıcı Adı - } - containerProps={{ className: "-ml-2.5" }} - /> - + setUsername(e.target.value)} + /> +
-
- + - Subscribe me to newsletter - - } - containerProps={{ className: "-ml-2.5" }} - /> - - - Forgot Password - - -
-
- - -
- - Not registered? - Create account - - + color="blue-gray" + className="mb-2 font-medium" + > + Şifre + + setPassword(e.target.value)} + /> +
-
-
- -
-
+ + + + ); } -export default SignIn; +export default SignIn; \ No newline at end of file diff --git a/src/pages/dashboard/home.jsx b/src/pages/dashboard/home.jsx index 2c700669..c6414cac 100644 --- a/src/pages/dashboard/home.jsx +++ b/src/pages/dashboard/home.jsx @@ -98,7 +98,7 @@ export function Home() { Action Another Action - Something else here + lllll else here diff --git a/src/pages/dashboard/notifications.jsx b/src/pages/dashboard/notifications.jsx index f4be88b0..8cf792e9 100644 --- a/src/pages/dashboard/notifications.jsx +++ b/src/pages/dashboard/notifications.jsx @@ -1,84 +1,100 @@ import React from "react"; import { Typography, - Alert, Card, CardHeader, CardBody, + Button, } from "@material-tailwind/react"; -import { InformationCircleIcon } from "@heroicons/react/24/outline"; -export function Notifications() { - const [showAlerts, setShowAlerts] = React.useState({ - blue: true, - green: true, - orange: true, - red: true, - }); - const [showAlertsWithIcon, setShowAlertsWithIcon] = React.useState({ - blue: true, - green: true, - orange: true, - red: true, - }); - const alerts = ["gray", "green", "orange", "red"]; +// Örnek güzergah verisi +const routesData = [ + { route: "İstanbul - Ankara" }, + { route: "İzmir - Antalya" }, + { route: "Bursa - Eskişehir" }, +]; +export function Notifications() { return (
+ {/* Güzergahlar başlığı ve ekleme butonu */} - - Alerts + + Güzergahlar + - - {alerts.map((color) => ( - setShowAlerts((current) => ({ ...current, [color]: false }))} - > - A simple {color} alert with an example link. Give - it a click if you like. - - ))} - - - - - - Alerts with Icon - - - - {alerts.map((color) => ( - - } - onClose={() => setShowAlertsWithIcon((current) => ({ - ...current, - [color]: false, - }))} - > - A simple {color} alert with an example link. Give - it a click if you like. - - ))} + + + + + + {["Güzergah", "İşlem"].map((el) => ( + + ))} + + + + + {routesData.map(({ route }, key) => { + const className = `py-3 px-5 ${ + key === routesData.length - 1 ? "" : "border-b border-blue-gray-50" + }`; + + return ( + + {/* Güzergah */} + + + {/* İşlem butonları */} + + + ); + })} + +
+ + {el} + +
+ + {route} + + +
+ + +
+
diff --git a/src/pages/dashboard/profile.jsx b/src/pages/dashboard/profile.jsx index 0d9f0115..f193372a 100644 --- a/src/pages/dashboard/profile.jsx +++ b/src/pages/dashboard/profile.jsx @@ -1,220 +1,118 @@ import { Card, - CardBody, CardHeader, - CardFooter, - Avatar, + CardBody, Typography, - Tabs, - TabsHeader, - Tab, - Switch, - Tooltip, Button, } from "@material-tailwind/react"; -import { - HomeIcon, - ChatBubbleLeftEllipsisIcon, - Cog6ToothIcon, - PencilIcon, -} from "@heroicons/react/24/solid"; -import { Link } from "react-router-dom"; -import { ProfileInfoCard, MessageCard } from "@/widgets/cards"; -import { platformSettingsData, conversationsData, projectsData } from "@/data"; +import { authorsTableData } from "@/data"; export function Profile() { return ( - <> -
-
-
- - -
-
- -
- - Richard Davis - - - CEO / Co-Founder - -
-
-
- - - - - App - - - - Message - - - - Settings - - - -
-
-
-
- - Platform Settings - -
- {platformSettingsData.map(({ title, options }) => ( -
- - {title} +
+ {/* Kullanıcılar Tablosu */} + + + + Kullanıcılar + + + + + + + + {["Ad Soyad", "Araç Plakası", "Telefon", "İşlem"].map((el) => ( + ))} - - - - - - - - ), - }} - action={ - - - - } - /> -
- - Platform Settings - -
    - {conversationsData.map((props) => ( - - reply - - } - /> - ))} -
-
- -
- - Projects - - - Architects design houses - -
- {projectsData.map( - ({ img, title, description, tag, route, members }) => ( - - - {title} - - +
+ + + {authorsTableData.map(({ name, plate, phone }, key) => { + const className = `py-3 px-5 ${ + key === authorsTableData.length - 1 + ? "" + : "border-b border-blue-gray-50" + }`; + + return ( + + {/* Ad Soyad */} + + + {/* Araç Plakası */} + + + {/* Telefon */} + + + {/* İşlem butonları alt alta ve sağa hizalı */} + + + ); + })} + +
+ + {el} -
- {options.map(({ checked, label }) => ( - - ))} -
- +
- {tag} + {name} + - {title} + {plate || "-"} + - {description} + {phone || "-"} - - - - +
+ + - -
- {members.map(({ img, name }, key) => ( - - - - ))}
- - - ) - )} -
- +
- +
); } diff --git a/src/pages/dashboard/tables.jsx b/src/pages/dashboard/tables.jsx index 3d453ed7..531a557b 100644 --- a/src/pages/dashboard/tables.jsx +++ b/src/pages/dashboard/tables.jsx @@ -3,31 +3,37 @@ import { CardHeader, CardBody, Typography, - Avatar, - Chip, - Tooltip, - Progress, + Button, } from "@material-tailwind/react"; -import { EllipsisVerticalIcon } from "@heroicons/react/24/outline"; -import { authorsTableData, projectsTableData } from "@/data"; +import { authorsTableData } from "@/data"; export function Tables() { return (
- + - Authors Table + Araçlar + + - +
- {["author", "function", "status", "employed", ""].map((el) => ( + {["Araçlar", "Şoför", "İşlem"].map((el) => ( + - {authorsTableData.map( - ({ img, name, email, job, online, date }, key) => { - const className = `py-3 px-5 ${ - key === authorsTableData.length - 1 - ? "" - : "border-b border-blue-gray-50" - }`; + {authorsTableData.map(({ plaka, driver }, key) => { + const className = `py-3 px-5 ${ + key === authorsTableData.length - 1 ? "" : "border-b border-blue-gray-50" + }`; - return ( - - - - - - - - ); - } - )} - -
-
- -
- - {name} - - - {email} - -
-
-
- - {job[0]} - - - {job[1]} - - - - - - {date} - - - - Edit - -
-
-
- - - - Projects Table - - - - - - - {["companies", "members", "budget", "completion", ""].map( - (el) => ( - + {/* Araç Plaka */} + - - - {projectsTableData.map( - ({ img, name, members, budget, completion }, key) => { - const className = `py-3 px-5 ${ - key === projectsTableData.length - 1 - ? "" - : "border-b border-blue-gray-50" - }`; + + + {/* Şoför */} + - return ( - - - - - - - - ); - } - )} + Sil + + + + + ); + })}
- - {el} + return ( +
+ + {plaka} - - ) - )} -
+ + {driver} + +
-
- - - {name} - -
-
- {members.map(({ img, name }, key) => ( - - - - ))} - - +
+
-
- - {completion}% - - -
-
- +
diff --git a/src/routes.jsx b/src/routes.jsx index 3a5a8da0..1d3ed3d1 100644 --- a/src/routes.jsx +++ b/src/routes.jsx @@ -7,7 +7,7 @@ import { RectangleStackIcon, } from "@heroicons/react/24/solid"; import { Home, Profile, Tables, Notifications } from "@/pages/dashboard"; -import { SignIn, SignUp } from "@/pages/auth"; +import { SignIn } from "@/pages/auth"; const icon = { className: "w-5 h-5 text-inherit", @@ -53,12 +53,6 @@ export const routes = [ path: "/sign-in", element: , }, - { - icon: , - name: "sign up", - path: "/sign-up", - element: , - }, ], }, ]; diff --git a/src/widgets/layout/dashboard-navbar.jsx b/src/widgets/layout/dashboard-navbar.jsx index d91e23f7..3173329a 100644 --- a/src/widgets/layout/dashboard-navbar.jsx +++ b/src/widgets/layout/dashboard-navbar.jsx @@ -1,30 +1,7 @@ +import { ArrowRightOnRectangleIcon, Bars3Icon } from "@heroicons/react/24/solid"; +import { IconButton, Input, Navbar, Typography, Breadcrumbs } from "@material-tailwind/react"; +import { useMaterialTailwindController, setOpenSidenav } from "@/context"; import { useLocation, Link } from "react-router-dom"; -import { - Navbar, - Typography, - Button, - IconButton, - Breadcrumbs, - Input, - Menu, - MenuHandler, - MenuList, - MenuItem, - Avatar, -} from "@material-tailwind/react"; -import { - UserCircleIcon, - Cog6ToothIcon, - BellIcon, - ClockIcon, - CreditCardIcon, - Bars3Icon, -} from "@heroicons/react/24/solid"; -import { - useMaterialTailwindController, - setOpenConfigurator, - setOpenSidenav, -} from "@/context"; export function DashboardNavbar() { const [controller, dispatch] = useMaterialTailwindController(); @@ -32,6 +9,11 @@ export function DashboardNavbar() { const { pathname } = useLocation(); const [layout, page] = pathname.split("/").filter((el) => el !== ""); + const handleLogout = () => { + // Buraya gerçek logout fonksiyonunu ekleyebilirsin + alert("Çıkış yapıldı!"); + }; + return ( -
+
+ {/* Breadcrumbs ve sayfa başlığı */}
- {layout} + {layout || "Home"} - - {page} + + {page || "Dashboard"} - - {page} + + {page || "Dashboard"}
-
+ + {/* Arama ve ikonlar */} +
- +
+ + {/* Sidenav toggle */} - - - - - - - - - - - - - - - -
- - New message from Laur - - - 13 minutes ago - -
-
- - -
- - New album by Travis Scott - - - 1 day ago - -
-
- -
- -
-
- - Payment successfully completed - - - 2 days ago - -
-
-
-
+ + {/* Çıkış butonu */} setOpenConfigurator(dispatch, true)} + color="red" + onClick={handleLogout} + className="rounded-full hover:bg-red-100 transition-colors" > - +
); } - -DashboardNavbar.displayName = "/src/widgets/layout/dashboard-navbar.jsx"; - -export default DashboardNavbar;