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/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..b9274b00 100644 --- a/src/pages/dashboard/tables.jsx +++ b/src/pages/dashboard/tables.jsx @@ -203,7 +203,7 @@ export function Tables() { + />a
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: , - }, ], }, ];