Skip to content

Commit

Permalink
code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyasbozdemir committed May 3, 2024
1 parent 6e8c9aa commit bc505ff
Show file tree
Hide file tree
Showing 11 changed files with 8,540 additions and 8,340 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class WorkInventory : BaseEntity<Guid>, IAuditable<Guid>
public Guid? BorrowLendId { get; set; }
public Guid EditionId { get; set; } // Eserin türü
public Guid? ShelfId { get; set; }
public Guid? BookCompartmentId { get; set; }
public Guid? WorkCompartmentId { get; set; }
public string BookNumber { get; set; }
public WorkStatus BookStatus { get; set; }
public bool IsAvailable { get; set; }
Expand All @@ -27,5 +27,5 @@ public class WorkInventory : BaseEntity<Guid>, IAuditable<Guid>

public virtual ICollection<BorrowLend>? BorrowLends { get; set; }

public virtual WorkCompartment BookCompartment { get; set; }
public virtual WorkCompartment WorkCompartment { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,9 @@ public void Configure(EntityTypeBuilder<WorkInventory> builder)
.HasConversion(new EnumToStringConverter<WorkStatus>());


builder.HasOne(bi => bi.BookCompartment)
builder.HasOne(bi => bi.WorkCompartment)
.WithMany(bc => bc.BookInventoryItems)
.HasForeignKey(bi => bi.BookCompartmentId)
.HasForeignKey(bi => bi.WorkCompartmentId)
.IsRequired(false);


builder.HasOne(bi => bi.BookCompartment)
.WithMany(bc => bc.BookInventoryItems)
.HasForeignKey(bi => bi.BookCompartmentId)
.IsRequired(false);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public static void Seed(ModelBuilder modelBuilder)


workInventory.ShelfId = shelfId;
workInventory.BookCompartmentId = compartmentId;
workInventory.WorkCompartmentId = compartmentId;
}


Expand Down

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { BsBook, BsBuilding, BsPeople } from "react-icons/bs";
import { FiHome, FiSettings } from "react-icons/fi";
import { BiSupport } from "react-icons/bi";
import { IoCreateOutline } from "react-icons/io5";
import { CiBoxList } from "react-icons/ci";

export const adminSidebarItems = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ import {
useColorModeValue,
Icon,
Flex,
useColorMode,
} from "@chakra-ui/react";
import Link from "next/link";
import ThemeSwitcher from "../../../../components/ThemeSwitcher";
import LanguageSwitcher from "../../../../components/LanguageSwitcher";
import { FiBell } from "react-icons/fi";



import { FiMinimize, FiMaximize } from "react-icons/fi";
import { HiMenuAlt2 } from "react-icons/hi";
Expand Down Expand Up @@ -85,6 +89,7 @@ const NavItem = ({ isMaximized, handleMaximizeToggle }) => {
return (
<>
<HStack spacing={3}>
<NotificationMenu/>
<LanguageSwitcher />
<ThemeSwitcher />

Expand Down Expand Up @@ -125,4 +130,72 @@ const NavItem = ({ isMaximized, handleMaximizeToggle }) => {
);
};



const NotificationMenu = () => {
const [isOpen, setIsOpen] = useState(false);
const notifications = [
{
id: 1,
title: "Yeni Mesaj",
content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
time: "5 dakika önce",
read: false,
},
{
id: 2,
title: "Bildirim",
content: "Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
time: "1 saat önce",
read: true,
},
{
id: 3,
title: "Bilgilendirme",
content: "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
time: "1 gün önce",
read: false,
},
];

const handleToggle = () => {
setIsOpen(!isOpen);
};

const { colorMode } = useColorMode();

// Okunmamış bildirim sayısını hesapla
const unreadNotificationsCount = notifications.filter(notification => !notification.read).length;

return (
<Menu isLazy>
<MenuButton
cursor="pointer"
boxSize={15}
_hover={{ color: colorMode === "light" ? "teal.500" : "teal.300" }}
onClick={handleToggle}
position="relative"
>
<FiBell />
</MenuButton>
<MenuList
zIndex={5}
border="2px solid"
borderColor="gray.200"
boxShadow="4px 4px 0"
minWidth="200px"
display={isOpen ? "block" : "none"}
>
{notifications.map((notification, index) => (
<MenuItem key={index}>
<VStack spacing={2} align="start">
<Text fontWeight="500">{notification.title}</Text>
<Text color="gray.500">{notification.content}</Text>
</VStack>
</MenuItem>
))}
</MenuList>
</Menu>
);
};
export default Navbar;
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import {
useColorModeValue,
Icon,
Flex,
useColorMode,
} from "@chakra-ui/react";
import Link from "next/link";
import ThemeSwitcher from "../../../../components/ThemeSwitcher";
import LanguageSwitcher from "../../../../components/LanguageSwitcher";

import { FiMinimize, FiMaximize } from "react-icons/fi";
import { FiMinimize, FiMaximize, FiBell } from "react-icons/fi";
import { HiMenuAlt2 } from "react-icons/hi";
import { CloseIcon } from "@chakra-ui/icons";

Expand Down Expand Up @@ -97,6 +98,7 @@ const NavItem = ({ isMaximized, handleMaximizeToggle }) => {
return (
<>
<HStack spacing={3}>
<NotificationMenu/>
<LanguageSwitcher />
<ThemeSwitcher />

Expand Down Expand Up @@ -136,5 +138,70 @@ const NavItem = ({ isMaximized, handleMaximizeToggle }) => {
</>
);
};
const NotificationMenu = () => {
const [isOpen, setIsOpen] = useState(false);
const notifications = [
{
id: 1,
title: "Yeni Mesaj",
content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
time: "5 dakika önce",
read: false,
},
{
id: 2,
title: "Bildirim",
content: "Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
time: "1 saat önce",
read: true,
},
{
id: 3,
title: "Bilgilendirme",
content: "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
time: "1 gün önce",
read: false,
},
];

const handleToggle = () => {
setIsOpen(!isOpen);
};

const { colorMode } = useColorMode();

// Okunmamış bildirim sayısını hesapla
const unreadNotificationsCount = notifications.filter(notification => !notification.read).length;

return (
<Menu isLazy>
<MenuButton
cursor="pointer"
boxSize={15}
_hover={{ color: colorMode === "light" ? "teal.500" : "teal.300" }}
onClick={handleToggle}
position="relative"
>
<FiBell />
</MenuButton>
<MenuList
zIndex={5}
border="2px solid"
borderColor="gray.200"
boxShadow="4px 4px 0"
minWidth="200px"
display={isOpen ? "block" : "none"}
>
{notifications.map((notification, index) => (
<MenuItem key={index}>
<VStack spacing={2} align="start">
<Text fontWeight="500">{notification.title}</Text>
<Text color="gray.500">{notification.content}</Text>
</VStack>
</MenuItem>
))}
</MenuList>
</Menu>
);
};
export default Navbar;
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import {
useColorModeValue,
Icon,
Flex,
useColorMode,
} from "@chakra-ui/react";
import Link from "next/link";
import ThemeSwitcher from "../../../../components/ThemeSwitcher";
import LanguageSwitcher from "../../../../components/LanguageSwitcher";

import { FiMinimize, FiMaximize } from "react-icons/fi";
import { FiMinimize, FiMaximize, FiBell } from "react-icons/fi";
import { HiMenuAlt2 } from "react-icons/hi";

const Navbar = ({ isOpen, onMenuToggle }) => {
Expand Down Expand Up @@ -85,6 +86,7 @@ const NavItem = ({ isMaximized, handleMaximizeToggle }) => {
return (
<>
<HStack spacing={3}>
<NotificationMenu/>
<LanguageSwitcher />
<ThemeSwitcher />

Expand Down Expand Up @@ -125,4 +127,71 @@ const NavItem = ({ isMaximized, handleMaximizeToggle }) => {
);
};

const NotificationMenu = () => {
const [isOpen, setIsOpen] = useState(false);
const notifications = [
{
id: 1,
title: "Yeni Mesaj",
content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
time: "5 dakika önce",
read: false,
},
{
id: 2,
title: "Bildirim",
content: "Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
time: "1 saat önce",
read: true,
},
{
id: 3,
title: "Bilgilendirme",
content: "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
time: "1 gün önce",
read: false,
},
];

const handleToggle = () => {
setIsOpen(!isOpen);
};

const { colorMode } = useColorMode();

// Okunmamış bildirim sayısını hesapla
const unreadNotificationsCount = notifications.filter(notification => !notification.read).length;

return (
<Menu isLazy>
<MenuButton
cursor="pointer"
boxSize={15}
_hover={{ color: colorMode === "light" ? "teal.500" : "teal.300" }}
onClick={handleToggle}
position="relative"
>
<FiBell />
</MenuButton>
<MenuList
zIndex={5}
border="2px solid"
borderColor="gray.200"
boxShadow="4px 4px 0"
minWidth="200px"
display={isOpen ? "block" : "none"}
>
{notifications.map((notification, index) => (
<MenuItem key={index}>
<VStack spacing={2} align="start">
<Text fontWeight="500">{notification.title}</Text>
<Text color="gray.500">{notification.content}</Text>
</VStack>
</MenuItem>
))}
</MenuList>
</Menu>
);
};

export default Navbar;

0 comments on commit bc505ff

Please sign in to comment.