Repository: pinecone-studio/pinecone-intern-monorepo
Pull request #4589: 4552 admin header
Author: login: erhme1
Labels: name: PR status: code ready
description: put this label when the code is ready for actions
Created: 2025-04-21T08:03:41Z | Merged: 2025-04-25T06:23:51Z

AdminHeader Change


Diff:
diff --git a/apps/L2A/leave-request/frontend/.nycrc b/apps/L2A/leave-request/frontend/.nycrc
index f212014c1b..12fc2dd7aa 100644
--- a/apps/L2A/leave-request/frontend/.nycrc
+++ b/apps/L2A/leave-request/frontend/.nycrc
@@ -8,8 +8,7 @@
     "coverage",
     "libs/**",
     "src/components/**",
-    "src/app/**/_components/**",
-    "src/app/**/components/**",
+    "src/**/_components/**",
     "src/common/**",
     "node_modules"
   ],
diff --git a/apps/L2A/leave-request/frontend/cypress/e2e/(admin)/admin.cy.tsx b/apps/L2A/leave-request/frontend/cypress/e2e/(admin)/admin.cy.tsx
new file mode 100644
index 0000000000..4dcdc3b0dd
--- /dev/null
+++ b/apps/L2A/leave-request/frontend/cypress/e2e/(admin)/admin.cy.tsx
@@ -0,0 +1,18 @@
+describe('AdminHeader', () => {
+  beforeEach(() => {
+    cy.visit('/admin');
+  });
+  it('renders logo, toggle button, and avatar', () => {
+    cy.get('img[src="PineconeStudio.png"]').should('be.visible');
+    cy.get('button').should('exist');
+    cy.get('img[src="https://github.com/shadcn.png"]').should('exist');
+  });
+
+  it('toggles dark mode on button click', () => {
+    cy.get('html').should('not.have.class', 'dark');
+    cy.get('button').click();
+    cy.get('html').should('have.class', 'dark');
+    cy.get('button').click();
+    cy.get('html').should('not.have.class', 'dark');
+  });
+});
diff --git a/apps/L2A/leave-request/frontend/public/PineconeStudio.png b/apps/L2A/leave-request/frontend/public/PineconeStudio.png
new file mode 100644
index 0000000000..cc7d40f593
Binary files /dev/null and b/apps/L2A/leave-request/frontend/public/PineconeStudio.png differ
diff --git a/apps/L2A/leave-request/frontend/specs/admin/AdminHeader.spec.tsx b/apps/L2A/leave-request/frontend/specs/admin/AdminHeader.spec.tsx
new file mode 100644
index 0000000000..2ab877741f
--- /dev/null
+++ b/apps/L2A/leave-request/frontend/specs/admin/AdminHeader.spec.tsx
@@ -0,0 +1,6 @@
+describe('' , () => {
+    it('', () => {
+        const test = 5
+        expect(test).toBe(5)
+    })
+})
\ No newline at end of file
diff --git a/apps/L2A/leave-request/frontend/src/app/admin/_components/AdminHeader.tsx b/apps/L2A/leave-request/frontend/src/app/admin/_components/AdminHeader.tsx
new file mode 100644
index 0000000000..4c4aeb48a9
--- /dev/null
+++ b/apps/L2A/leave-request/frontend/src/app/admin/_components/AdminHeader.tsx
@@ -0,0 +1,30 @@
+import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
+import { useEffect, useState } from 'react';
+import { Moon, Sun } from 'lucide-react';
+
+export const AdminHeader = () => {
+  const [isDarkMode, setIsDarkMode] = useState(false);
+
+  useEffect(() => {
+    if (isDarkMode) {
+      document.documentElement.classList.add('dark');
+    } else {
+      document.documentElement.classList.remove('dark');
+    }
+  }, [isDarkMode]);
+
+  return (
+    <div className="mt-5 ml-10 mr-10 flex items-center justify-between">
+      <img src="PineconeStudio.png" className="bg-white" />
+      <div className="flex items-center gap-4">
+        <button className="rounded-full border p-2" onClick={() => setIsDarkMode(!isDarkMode)}>
+          {isDarkMode ? <Moon /> : <Sun />}
+        </button>
+        <Avatar>
+          <AvatarImage src="https://github.com/shadcn.png" />
+          <AvatarFallback>CN</AvatarFallback>
+        </Avatar>
+      </div>
+    </div>
+  );
+};
diff --git a/apps/L2A/leave-request/frontend/src/app/admin/page.tsx b/apps/L2A/leave-request/frontend/src/app/admin/page.tsx
index 5bbfc21404..d999b0707c 100644
--- a/apps/L2A/leave-request/frontend/src/app/admin/page.tsx
+++ b/apps/L2A/leave-request/frontend/src/app/admin/page.tsx
@@ -1,6 +1,7 @@
 'use client';
 
 import { useState } from 'react';
+import { AdminHeader } from './_components/AdminHeader';
 import { RegisterNewEmployeeButton } from './_components/Button';
 import { RegisterNewEmployeeModal } from './_components/Modal';
 
@@ -9,6 +10,7 @@ const Page = () => {
 
   return (
     <div>
+         <AdminHeader />
       <div className="p-4">
         <RegisterNewEmployeeButton onClick={() => setIsModalOpen(true)} />
         <RegisterNewEmployeeModal isOpen={isModalOpen} onClose={() => setIsModalOpen(false)} />
diff --git a/apps/L2A/leave-request/frontend/src/graphql/all.graphql b/apps/L2A/leave-request/frontend/src/graphql/all.graphql
index 257fd76304..cffb94c813 100644
--- a/apps/L2A/leave-request/frontend/src/graphql/all.graphql
+++ b/apps/L2A/leave-request/frontend/src/graphql/all.graphql
@@ -1,7 +1,25 @@
-query Query {
+# Queries
+query SampleQuery {
   sampleQuery
 }
 
-mutation Mutation {
-  sampleMutation
+# Mutations
+mutation CreateUser($userArgs: UserInput!) {
+  createUser(userArgs: $userArgs) {
+    id
+    username
+    email
+    profilePicture
+    role
+    createdAt
+    updatedAt
+  }
+}
+
+mutation RequestOTP($email: String!) {
+  requestOTP(email: $email)
+}
+
+mutation VerifyOTP($email: String!, $otp: String!) {
+  verifyOTP(email: $email, otp: $otp)
 }


Reviews:
user: login: Munkhtsolmon2222
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-04-21T08:18:09Z
user: login: soulforger1
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-23T04:36:20Z
user: login: soulforger1
body: conflict zasad bolloo
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-24T10:07:35Z

Review comments:
diff_hunk: @@ -0,0 +1,6 @@
+describe('' , () => {
+    it('', () => {
path: apps/L2A/leave-request/frontend/specs/admin/AdminHeader.spec.tsx
user: login: soulforger1
body: test name, test case name bichii
created_at: 2025-04-23T04:35:23Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,6 @@
+describe('' , () => {
+    it('', () => {
+        const test = 5
+        expect(test).toBe(5)
path: apps/L2A/leave-request/frontend/specs/admin/AdminHeader.spec.tsx
user: login: soulforger1
body: end component oo duudad shalgana
created_at: 2025-04-23T04:35:38Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,21 @@
+import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
+import { Sun } from 'lucide-react';
+
+export const AdminHeader = () => {
+  return (
+    <div>
path: apps/L2A/leave-request/frontend/src/app/admin/_components/AdminHeader.tsx
user: login: soulforger1
body: iluu div baina
created_at: 2025-04-23T04:35:50Z
author_association: CONTRIBUTOR
path: apps/L2A/leave-request/frontend/public/Pinecone Studio.png
user: login: soulforger1
body: file name iig zaitai bichihgui
created_at: 2025-04-23T04:36:17Z
author_association: CONTRIBUTOR

PR comments:
user: login: github-actions[bot]
created_at: 2025-04-21T08:08:37Z
body: 4589:
**LEAVE-REQUEST-FRONTEND Preview Link:** [https://leave-request-frontend-h5474zpt0-team3s-projects.vercel.app](https://leave-request-frontend-h5474zpt0-team3s-projects.vercel.app)
author_association: NONE
user: login: soulforger1
created_at: 2025-04-23T04:34:55Z
body: @erhme1 @Munkhtsolmon2222 ene test iin davuulad belen bolgomor baina
author_association: CONTRIBUTOR