Skip to content

Commit

Permalink
Teacher Role Transaction | SIS-84 (#39)
Browse files Browse the repository at this point in the history
* Teacher Navbar Adjusted For Role

* Teacher Component Updated and Fixed

* Teacher Navbar Updated

* Teacher Component Updated and add cookies function.

* Teacher Component Updated and fixed.

* Teacher Component and Navbar Updated and fixed.

* Teacher Component Updated and fixed.

Co-authored-by: agitrubard <[email protected]>
  • Loading branch information
berinkrktt and agitrubard authored Mar 5, 2022
1 parent c4da115 commit ac1216e
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 62 deletions.
135 changes: 74 additions & 61 deletions public/components/navbar/teacher/teacher-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import {
ViewGridIcon,
} from '@heroicons/react/outline'
import {ChevronDownIcon} from '@heroicons/react/solid'
import {getTeacherRole} from "../../../storage/teacher";

const solutions = [

const lesson = [
{
name: 'Derslerim',
description: '',
Expand All @@ -25,28 +27,31 @@ const solutions = [
}
]

const resources = [
const otherTransactions = [
{
name: 'Staj İşlemleri',
description: '',
href: '/student/notes',
roles: ['ADVISOR', 'HEAD_OF_DEPARTMENT'],
icon: BookmarkAltIcon,
},
{
name: 'Mezuniyet İşlemleri',
description: '',
href: '/student/transcript',
roles: ['ADVISOR', 'HEAD_OF_DEPARTMENT'],
icon: DocumentReportIcon,
},
{
name: 'Ders Kayıt İşlemleri',
description: '',
href: '/student/transcript',
roles: ['ADVISOR', 'HEAD_OF_DEPARTMENT'],
icon: CalendarIcon,
},
]

const schedules = [
const programs = [
{
name: 'Ders Programı',
description: "",
Expand All @@ -67,8 +72,10 @@ function classNames(...classes) {

export default function TeacherComponent() {

const teacherRole = getTeacherRole();

return (
<Popover.Group as="nav" className="hidden md:flex space-x-10 font-phenomenaBold">
<Popover.Group as="nav" className="select-none hidden md:flex space-x-10 font-phenomenaBold">
<Popover className="relative">
{({open}) => (
<>
Expand Down Expand Up @@ -102,7 +109,7 @@ export default function TeacherComponent() {
<div
className="rounded-lg shadow-lg ring-1 ring-black ring-opacity-5 overflow-hidden">
<div className="relative grid gap-6 bg-white px-5 py-6 sm:gap-8 sm:p-8">
{solutions.map((item) => (
{lesson.map((item) => (
<a
key={item.name}
href={item.href}
Expand All @@ -124,61 +131,6 @@ export default function TeacherComponent() {
)}
</Popover>

<Popover className="relative">
{({open}) => (
<>
<Popover.Button
className={classNames(
open ? 'text-sis-yellow' : 'text-gray-500',
'group bg-white rounded-md inline-flex items-center text-xl hover:text-sis-yellow focus:outline-none'
)}
>
<span>DİĞER İŞLEMLERİ</span>
<ChevronDownIcon
className={classNames(
open ? 'text-sis-yellow' : 'text-gray-500',
'ml-2 h-5 w-5 group-hover:text-sis-yellow'
)}
aria-hidden="true"
/>
</Popover.Button>

<Transition
as={Fragment}
enter="transition ease-out duration-200"
enterFrom="opacity-0 translate-y-1"
enterTo="opacity-100 translate-y-0"
leave="transition ease-in duration-150"
leaveFrom="opacity-100 translate-y-0"
leaveTo="opacity-0 translate-y-1"
>
<Popover.Panel
className="absolute z-10 left-1/2 transform -translate-x-1/2 mt-3 px-2 w-screen max-w-md sm:px-0">
<div
className="rounded-lg shadow-lg ring-1 ring-black ring-opacity-5 overflow-hidden">
<div className="relative grid gap-6 bg-white px-5 py-6 sm:gap-8 sm:p-8">
{resources.map((item) => (
<a
key={item.name}
href={item.href}
className="-m-3 p-3 flex items-start rounded-lg hover:bg-gray-50"
>
<item.icon className="flex-shrink-0 h-6 w-6 text-sis-yellow"
aria-hidden="true"/>
<div className="ml-4">
<p className="font-phenomenaRegular text-xl text-gray-800">{item.name}</p>
<p className="mt-1 text-sm text-gray-500">{item.description}</p>
</div>
</a>
))}
</div>
</div>
</Popover.Panel>
</Transition>
</>
)}
</Popover>

<a href=""
className="text-xl font-medium text-gray-500 hover:text-sis-yellow">
NOT İŞLEMLERİ
Expand Down Expand Up @@ -222,7 +174,7 @@ export default function TeacherComponent() {
<div
className="rounded-lg shadow-lg ring-1 ring-black ring-opacity-5 overflow-hidden">
<div className="relative grid gap-6 bg-white px-5 py-6 sm:gap-8 sm:p-8">
{schedules.map((item) => (
{programs.map((item) => (
<a
key={item.name}
href={item.href}
Expand All @@ -244,6 +196,67 @@ export default function TeacherComponent() {
)}
</Popover>

{(
teacherRole === 'ADVISOR' || teacherRole === 'HEAD_OF_DEPARTMENT'
?
<Popover className="relative">
{({open}) => (
<>
<Popover.Button
className={classNames(
open ? 'text-sis-yellow' : 'text-gray-500',
'group bg-white rounded-md inline-flex items-center text-xl hover:text-sis-yellow focus:outline-none'
)}
>
<span>DİĞER İŞLEMLER</span>
<ChevronDownIcon
className={classNames(
open ? 'text-sis-yellow' : 'text-gray-500',
'ml-2 h-5 w-5 group-hover:text-sis-yellow'
)}
aria-hidden="true"
/>
</Popover.Button>

<Transition
as={Fragment}
enter="transition ease-out duration-200"
enterFrom="opacity-0 translate-y-1"
enterTo="opacity-100 translate-y-0"
leave="transition ease-in duration-150"
leaveFrom="opacity-100 translate-y-0"
leaveTo="opacity-0 translate-y-1"
>
<Popover.Panel
className="absolute z-10 left-1/2 transform -translate-x-1/2 mt-3 px-2 w-screen max-w-md sm:px-0">
<div
className="rounded-lg shadow-lg ring-1 ring-black ring-opacity-5 overflow-hidden">
<div className="relative grid gap-6 bg-white px-5 py-6 sm:gap-8 sm:p-8">
{otherTransactions.map((item) => (
<a
key={item.name}
href={item.href}
className="-m-3 p-3 flex items-start rounded-lg hover:bg-gray-50"
>
<item.icon className="flex-shrink-0 h-6 w-6 text-sis-yellow"
aria-hidden="true"/>
<div className="ml-4">
<p className="font-phenomenaRegular text-xl text-gray-800">{item.name}</p>
<p className="mt-1 text-sm text-gray-500">{item.description}</p>
</div>
</a>
))}
</div>
</div>
</Popover.Panel>
</Transition>
</>
)}
</Popover>
:
null
)}

</Popover.Group>
)
}
2 changes: 1 addition & 1 deletion public/components/navbar/teacher/teacher-navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function classNames(...classes) {
export default function TeacherNavbar() {

return (
<Popover className="relative bg-white">
<Popover className="select-none relative bg-white">
<div className="max-w-7xl mx-auto px-4 sm:px-6">
<div
className="flex justify-between items-center border-b-2 border-gray-100 py-6 md:justify-start md:space-x-10">
Expand Down

0 comments on commit ac1216e

Please sign in to comment.