Skip to content
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d7f3e6c
86b1vx0v2:Created Header.tsx with an avatar, dropdown menu (Profile, …
Asfik-1999 Aug 27, 2024
7667e5e
86b1vx0v2:Added Layout.tsx for the overall structure of the application.
Asfik-1999 Aug 27, 2024
6cea914
86b1vx0v2: created header module css
Asfik-1999 Aug 27, 2024
4186b7c
86b1vx0v2: package-lock update
Asfik-1999 Aug 27, 2024
d87a8ee
86b1vx0v2: package json update
Asfik-1999 Aug 27, 2024
4f3a40b
86b1vx0v2: delete Layout and Header File
Asfik-1999 Aug 29, 2024
59f46ce
Merge branch 'development' into 86b1vx0v2
Asfik-1999 Aug 29, 2024
5063490
86b1vx0v2: Integrated `ProfileCard` and `Avatar` components in `RootL…
Asfik-1999 Aug 29, 2024
dc2f06b
86b1vx0v2: Hide the logout button
Asfik-1999 Aug 29, 2024
b8b8bb0
86b1vx0v2: Implemented conditional rendering to hide these components…
Asfik-1999 Aug 29, 2024
eabfa47
86b1vx0v2: Create Avatar Componenet
Asfik-1999 Aug 29, 2024
b248ef9
86b1vx0v2: Craete card component
Asfik-1999 Aug 29, 2024
f7d0bf4
86b1vx0v2: Add logo
Asfik-1999 Aug 29, 2024
c172329
86b1vx0v2: Implement ProfileCard with toggle and logout functionality
Asfik-1999 Aug 29, 2024
ae6ad1c
86b1vx0v2: Update ProfileCard component with improved styling and log…
Asfik-1999 Aug 30, 2024
5df067f
Merge branch 'development' into 86b1vx0v2
Asfik-1999 Aug 30, 2024
f56a359
86b1vx0v2: update package
Asfik-1999 Aug 30, 2024
f1a0c25
86b1vx0v2: Removed the handleLogout function and associated logic fro…
Asfik-1999 Aug 30, 2024
4604ab2
Merge branch 'development' into 86b1vx0v2
Asfik-1999 Aug 31, 2024
c63bae5
86b1vx0v2 : Remove conflicts
Asfik-1999 Aug 31, 2024
0f92b49
Merge branch 'development' into 86b1vx0v2
Asfik-1999 Sep 1, 2024
f569066
Merge branch 'development' into 86b1vx0v2
Asfik-1999 Sep 2, 2024
d80bd87
86b1vx0v2: package update
Asfik-1999 Sep 2, 2024
9feb7d6
Merge branch 'development' into 86b1vx0v2
Asfik-1999 Sep 2, 2024
fefe3e2
86b1vx0v2: converted to server component
Asfik-1999 Sep 2, 2024
9674436
86b1vx0v2: Remove file depentency
Asfik-1999 Sep 2, 2024
eb4cfb0
86b1vx0v2 : Remove conflicts
Asfik-1999 Sep 2, 2024
a5bb525
Merge branch 'development' into 86b1vx0v2 and fix conflict
Asfik-1999 Sep 2, 2024
7f0b682
86b1vx0v2: remove conflicts
Asfik-1999 Sep 2, 2024
2ae304c
update after remove depentency
Asfik-1999 Sep 4, 2024
57e513a
Merge branch 'development' into 86b1vx0v2
Asfik-1999 Sep 8, 2024
6a536cf
Merge branch 'development' into 86b1vx0v2
Asfik-1999 Sep 9, 2024
c3a828e
remove package.json
Asfik-1999 Sep 9, 2024
081a80d
Merge branch '86b1vx0v2' of https://github.com/tracet2t/Digital-Logbo…
Asfik-1999 Sep 9, 2024
12a473c
remove conflicts
Asfik-1999 Sep 9, 2024
01f6928
Remove antd
Asfik-1999 Sep 11, 2024
fd76e9f
Merge branch 'development' of github.com:tracet2t/Digital-Logbook int…
thlurte Sep 11, 2024
c58a27a
Merge branch '86b1vx0v2' of github.com:tracet2t/Digital-Logbook into …
thlurte Sep 11, 2024
ba2f304
Remove conflict
Asfik-1999 Sep 11, 2024
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
42 changes: 41 additions & 1 deletion server/package-lock.json

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

2 changes: 2 additions & 0 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"dependencies": {
"@prisma/client": "^5.18.0",
"@radix-ui/react-alert-dialog": "^1.1.1",
"@radix-ui/react-avatar": "^1.1.0",
"@radix-ui/react-dialog": "^1.1.1",
"@radix-ui/react-scroll-area": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
Expand All @@ -32,6 +33,7 @@
"dotenv": "^16.4.5",
"dotenv-cli": "^7.4.2",
"jose": "^5.8.0",
"lib_test": "file:",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this? Remove it, if it's unnecessary. Explain here if it's necessary.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary, I will remove that.

"lucide-react": "^0.436.0",
"next": "14.2.5",
"react": "^18",
Expand Down
Binary file added server/public/t2t logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions server/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './index.css';
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import { AntdRegistry } from '@ant-design/nextjs-registry';
import ConditionalLayout from "@/components/ConditionalLayout";

const inter = Inter({ subsets: ["latin"] });

Expand All @@ -17,8 +17,10 @@ export default function RootLayout({
}>) {
return (
<html lang="en">
<body className={inter.className}>
<AntdRegistry>{children}</AntdRegistry>
<body className={`${inter.className} relative`}>
<ConditionalLayout>
{children}
</ConditionalLayout>
</body>
</html>
);
Expand Down
37 changes: 37 additions & 0 deletions server/src/components/ConditionalLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'use client';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't query file path name. The common header should only be displayed if the user is authenticated. Use the session object here, and convert this to a server component. @thlurte please provide him guidance if necessary.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok,


import { usePathname } from 'next/navigation'; // Import usePathname
import ProfileCard from "@/components/ProfileCard";

const ConditionalLayout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const pathname = usePathname(); // Get the current pathname

const isLoginPage = pathname === '/login'; // Check if the current page is the login page

return (
<>
{!isLoginPage && (
<>
{/* Logo in the top-left corner */}
<div className="absolute top-4 left-4">
<img
src="../t2t logo.png" // Ensure correct file path and name
alt="T2T Logo"
className="w-24 h-auto" // Adjust size as needed
/>
</div>

{/* ProfileCard component in the top-right corner */}
<div className="absolute top-4 right-4">
<ProfileCard />
</div>
</>
)}
<main className="p-4">
{children}
</main>
</>
);
};

export default ConditionalLayout;
58 changes: 58 additions & 0 deletions server/src/components/ProfileCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"use client";

import { useState } from "react";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Card, CardContent, CardHeader, CardTitle, CardFooter } from "@/components/ui/card";

export default function ProfileCard() {
const [isCardVisible, setIsCardVisible] = useState(false);

// Toggle the visibility of the card
const toggleCardVisibility = () => {
setIsCardVisible(!isCardVisible);
};

return (
<div className="relative">
{/* Button to toggle the visibility of the profile card */}
<button onClick={toggleCardVisibility} className="absolute top-4 right-4">
<Avatar>
<AvatarImage src="https://github.com/shadcn.png" />
<AvatarFallback>CN</AvatarFallback>
</Avatar>
</button>

{/* Conditional rendering of the profile card */}
{isCardVisible && (
<div className="absolute top-16 right-0 bg-gradient-to-b from-blue-100 to-blue-200 p-3 border border-gray-200 rounded shadow-lg">
<Card className="w-56 rounded-lg overflow-hidden shadow-xl">
{/* Card header with avatar and green background */}
<CardHeader className="relative flex flex-col items-center justify-center bg-green-400 h-28 p-3">
<Avatar className="w-20 h-20 border-4 border-white absolute -bottom-10">
<AvatarImage src="https://github.com/shadcn.png" />
<AvatarFallback>CN</AvatarFallback>
</Avatar>
</CardHeader>

{/* Card content displaying the user's name and email */}
<CardContent className="mt-12 text-center p-2">
<CardTitle className="text-md font-semibold">Mohamed Asfik</CardTitle>
<p className="text-xs text-gray-700">[email protected]</p>
</CardContent>

{/* Card footer with the logout button */}
<CardFooter className="flex justify-center p-2">
{/* Remove the logout functionality */}
<button
className="bg-gray-500 text-white py-1 px-3 rounded-md hover:bg-gray-600"

>
Logout
</button>
</CardFooter>
</Card>
</div>
)}
</div>
);
}
2 changes: 2 additions & 0 deletions server/src/components/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ import {
AlertDialogHeader,
AlertDialogTitle
} from "@/components/ui/alert-dialog";

import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button";
import { Textarea } from "@/components/ui/textarea";


moment.locale('en-GB');
const localizer = momentLocalizer(moment);

Expand Down
50 changes: 50 additions & 0 deletions server/src/components/ui/avatar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"use client"

import * as React from "react"
import * as AvatarPrimitive from "@radix-ui/react-avatar"

import { cn } from "@/lib/utils"

const Avatar = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Root
ref={ref}
className={cn(
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
className
)}
{...props}
/>
))
Avatar.displayName = AvatarPrimitive.Root.displayName

const AvatarImage = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Image>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Image
ref={ref}
className={cn("aspect-square h-full w-full", className)}
{...props}
/>
))
AvatarImage.displayName = AvatarPrimitive.Image.displayName

const AvatarFallback = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Fallback>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Fallback
ref={ref}
className={cn(
"flex h-full w-full items-center justify-center rounded-full bg-muted",
className
)}
{...props}
/>
))
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName

export { Avatar, AvatarImage, AvatarFallback }
79 changes: 79 additions & 0 deletions server/src/components/ui/card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import * as React from "react"

import { cn } from "@/lib/utils"

const Card = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"rounded-lg border bg-card text-card-foreground shadow-sm",
className
)}
{...props}
/>
))
Card.displayName = "Card"

const CardHeader = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("flex flex-col space-y-1.5 p-6", className)}
{...props}
/>
))
CardHeader.displayName = "CardHeader"

const CardTitle = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLHeadingElement>
>(({ className, ...props }, ref) => (
<h3
ref={ref}
className={cn(
"text-2xl font-semibold leading-none tracking-tight",
className
)}
{...props}
/>
))
CardTitle.displayName = "CardTitle"

const CardDescription = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => (
<p
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
CardDescription.displayName = "CardDescription"

const CardContent = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
))
CardContent.displayName = "CardContent"

const CardFooter = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("flex items-center p-6 pt-0", className)}
{...props}
/>
))
CardFooter.displayName = "CardFooter"

export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }