Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case project #35

Merged
merged 2 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class MailAccountConfiguration : BaseEntity<int>
{
public int Id { get; set; }

public string Owner { get; set; }
public string Purpose { get; set; }
public string SmtpServer { get; set; }
public int Port { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public void Configure(EntityTypeBuilder<Domain.Entities.Configuration.MailAccoun
{
builder.ToTable("MailAccounts", schema: "static");// Veritabanında tablo adı
builder.HasKey(ms => ms.Id); // Primary key olarak Id'yi kullanma
builder.Property(ms => ms.Owner).IsRequired().HasMaxLength(100); // Owner özelliği zorunlu ve maksimum 100 karakter olmalı
builder.Property(ms => ms.Purpose).IsRequired().HasMaxLength(100); // Owner özelliği zorunlu ve maksimum 100 karakter olmalı
builder.Property(ms => ms.SmtpServer).IsRequired().HasMaxLength(100); // SmtpServer özelliği zorunlu ve maksimum 100 karakter olmalı
builder.Property(ms => ms.Port).IsRequired(); // Port özelliği zorunlu
builder.Property(ms => ms.SenderEmail).IsRequired().HasMaxLength(100); // SenderEmail özelliği zorunlu ve maksimum 100 karakter olmalı
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.

46 changes: 46 additions & 0 deletions LibraryTrackingApp/src/frontend/components/Analytics.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { useApp } from "@/contexts/AppContext";
import FacebookPixel from "@/plugins/FacebookPixel";
import GoogleAnalytics from "@/plugins/GoogleAnalytics";
import GoogleTagManager from "@/plugins/GoogleTagManager";
import GoogleTagManagerBody from "@/plugins/GoogleTagManagerBody";
import LinkedInInsightTag from "@/plugins/LinkedInInsightTag";
import TiktokPixel from "@/plugins/TiktokPixel";
import Head from "next/head";
import React from "react";

const Analytics = ({ isAdmin = false }) => {
const { analytics, adminAnalytics } = useApp();

const selectedAnalytics = isAdmin ? adminAnalytics : analytics;

return (
<>
<Head>
{selectedAnalytics.GoogleAnalytics.isActive && (
<GoogleAnalytics code={selectedAnalytics.GoogleAnalytics.code} />
)}
{selectedAnalytics.FacebookPixel.isActive && (
<FacebookPixel code={selectedAnalytics.FacebookPixel.code} />
)}
{selectedAnalytics.GoogleTagManager.isActive && (
<GoogleTagManager code={selectedAnalytics.GoogleTagManager.code} />
)}
{selectedAnalytics.TiktokPixel.isActive && (
<TiktokPixel code={selectedAnalytics.TiktokPixel.code} />
)}
{selectedAnalytics.LinkedInInsightTag.isActive && (
<LinkedInInsightTag
code={selectedAnalytics.LinkedInInsightTag.code}
/>
)}
</Head>
<>
{selectedAnalytics.GoogleAnalytics.isActive && (
<GoogleTagManagerBody code={selectedAnalytics.GoogleAnalytics.code} />
)}
</>
</>
);
};

export default Analytics;
12 changes: 6 additions & 6 deletions LibraryTrackingApp/src/frontend/constants/appSidebarItems.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,6 @@ export const sidebarItems = [
},
],
},
{
title: "Ayarlar",
icon: <FiSettings />,
href: "/app/settings",
target: "_self",
},
{
title: "Geliştirici Belgeleri",
icon: <FiBook />,
Expand All @@ -240,6 +234,12 @@ export const sidebarItems = [
href: "/app/support",
target: "_self",
},
{
title: "Ayarlar",
icon: <FiSettings />,
href: "/app/settings",
target: "_self",
},
{
title: "Çıkış Yap",
icon: <FiLogOut />,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const meSidebarItems = [
{
title: "Kütüphanelerim",
icon: <FaBook />,
href: "/me/library",
href: "/me/libraries",
target: "_self",
subItems: [],
},
Expand Down
73 changes: 69 additions & 4 deletions LibraryTrackingApp/src/frontend/contexts/AppContext.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,76 @@
import React, { createContext, useContext } from "react";
import React, { createContext, useContext, useState } from "react";
import initialSiteInfo, {
footerData,
navLinks,
dropdownLinks,
footerLinks,
socialMediaLinks
socialMediaLinks,
} from "./appContextValues";

const AppContext = createContext();

export const useAppContext = () => {
return useContext(AppContext);
};

export const AppContextProvider = ({ children }) => {
const [analytics, setAnalytics] = useState({
FacebookPixel: { isActive: true, code: "" },
GoogleAnalytics: { isActive: true, code: "" },
LinkedInInsightTag: { isActive: true, code: "" },
GoogleTagManager: { isActive: true, code: "" },
TiktokPixel: { isActive: true, code: "" },
TwitterPixel: { isActive: true, code: "" },
});

const toggleAnalytics = (name) => {
setAnalytics((prevState) => ({
...prevState,
[name]: {
...prevState[name],
isActive: !prevState[name].isActive,
},
}));
};

const updateCode = (name, newCode) => {
setAnalytics((prevState) => ({
...prevState,
[name]: {
...prevState[name],
code: newCode,
},
}));
};

const [adminAnalytics, setAdminAnalytics] = useState({
FacebookPixel: { isActive: true, code: "" },
GoogleAnalytics: { isActive: true, code: "" },
LinkedInInsightTag: { isActive: true, code: "" },
GoogleTagManager: { isActive: true, code: "" },
TiktokPixel: { isActive: true, code: "" },
TwitterPixel: { isActive: true, code: "" },
});

const toggleAdminAnalytics = (name) => {
setAdminAnalytics((prevState) => ({
...prevState,
[name]: {
...prevState[name],
isActive: !prevState[name].isActive,
},
}));
};

const updateAdminCode = (name, newCode) => {
setAdminAnalytics((prevState) => ({
...prevState,
[name]: {
...prevState[name],
code: newCode,
},
}));
};

const siteInfo = initialSiteInfo;

const contextValue = {
Expand All @@ -22,7 +79,15 @@ export const AppContextProvider = ({ children }) => {
footerLinks,
footerData,
siteInfo,
socialMediaLinks
socialMediaLinks,
analytics,
setAnalytics,
adminAnalytics,
setAdminAnalytics,
toggleAnalytics,
updateCode,
toggleAdminAnalytics,
updateAdminCode,
};
return (
<AppContext.Provider value={contextValue}>{children}</AppContext.Provider>
Expand Down
2 changes: 2 additions & 0 deletions LibraryTrackingApp/src/frontend/contexts/appContextValues.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ initialSiteInfo.phoneNumberDisplay = formatPhoneNumber(
initialSiteInfo.phoneNumber
);



export {
navLinks,
dropdownLinks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const navLinks = [
{ name: "Hakkımızda", path: "/about", target: "_self" },
{ name: "Özellikler", path: "/features", target: "_self" },
{ name: "Dökümantasyon", path: "/docs", target: "_blank" },
{ name: "Topluluk", path: "/community", target: "_self" },
{ name: "Forum", path: "/forum", target: "_self" },
{ name: "Blog", path: "/blog" },
];

Expand Down
2 changes: 2 additions & 0 deletions LibraryTrackingApp/src/frontend/layouts/Anon/layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import Navbar from "./components/Navbar";
import { tourSteps } from "./guides/tourSteps";
import TourComponent from "@/components/TourComponent";
import Footer from "./components/Footer";
import Analytics from "@/components/Analytics";

function Layout({ children }) {
return (
<>
<TourComponent tourSteps={tourSteps} layoutName="mainLayout" />
<Navbar />
<Analytics isAdmin={true} />
{children}
<Footer/>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ import {
Icon,
Flex,
useColorMode,
IconButton,
} from "@chakra-ui/react";
import Link from "next/link";
import ThemeSwitcher from "../../../../components/ThemeSwitcher";
import LanguageSwitcher from "../../../../components/LanguageSwitcher";

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

const Navbar = ({ isOpen, onMenuToggle }) => {
const [isMaximized, setIsMaximized] = useState(false);
Expand Down Expand Up @@ -96,9 +98,19 @@ const Navbar = ({ isOpen, onMenuToggle }) => {

const NavItem = ({ isMaximized, handleMaximizeToggle }) => {
const { colorMode } = useColorMode();

return (
<>
<HStack spacing={3}>
<Icon
as={TfiHome}
cursor={"pointer"}
mx={2.5}
onClick={() => {
window.open("/", "_blank");
}}
/>

<NotificationMenu />
<LanguageSwitcher />
<ThemeSwitcher />
Expand Down
3 changes: 1 addition & 2 deletions LibraryTrackingApp/src/frontend/layouts/App/layout.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Box, Flex } from "@chakra-ui/react";
import Head from "next/head";
import React, { useState } from "react";

import Navbar from "./components/Navbar";
import Sidebar from "./components/Sidebar";

Expand All @@ -16,7 +15,7 @@ function Layout({ children }) {
<Head>
<meta name="robots" content="noindex, nofollow" />
<link rel="icon" href="/favicon.ico" />
<title>Library Managament</title>
<title>Kütüphane Yönetim Platformu</title>
</Head>

<Sidebar isOpen={isSidebarOpen} toggleSidebar={toggleSidebar} />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {
Link as CLink,
Flex,
} from "@chakra-ui/react";


import React from "react";

const Footer = () => {


return (
<Flex justifyContent={'center'}>
<FooterData/>
</Flex>
);
};


const FooterData = () => {
const startYear = 2023;
const currentYear = new Date().getFullYear();
let yearText;
if (currentYear > startYear) {
yearText = `${startYear}-${currentYear}`;
} else {
yearText = `${startYear}`;
}
return <> {yearText} &copy; Tüm Hakları Saklıdır.</>;
};
export async function getStaticProps({ locale }) {
return {
props: {
...(await serverSideTranslations(locale, ["common"])),
},
};
}

export default React.memo(Footer);
Loading
Loading