Skip to content

Commit

Permalink
Make Components for the About Page (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
hokwaichan authored May 29, 2024
1 parent 5c5a786 commit 62b78d3
Show file tree
Hide file tree
Showing 8 changed files with 238 additions and 191 deletions.
55 changes: 55 additions & 0 deletions ui/src/app/about/_components/GeneralInfoSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const GeneralInfoSection = () => {
const generalInfoItems = [
{
question: 'How do I request a new grouping?',
answer: (
<a className="text-link-color hover:underline hover:text-link-hover-color"
href="https://uhawaii.atlassian.net/wiki/spaces/UHIAM/pages/13402308/UH+Groupings+Request+Form"
aria-label="A request form is available">
A request form is available.
</a>
)
},
{
question: 'What is the Include members list?',
answer: 'A grouping\'s Include is the portion of the grouping membership that is manually updated. It may be empty.'
},
{
question: 'Exactly what is a grouping?',
answer: (
<>
<a className="text-link-color hover:underline hover:text-link-hover-color"
href="https://uhawaii.atlassian.net/wiki/spaces/UHIAM/pages/13403213/UH+Groupings"
aria-label="General information about groupings is available">
General information about groupings is available.
</a> {' '}
A grouping&apos;s components include the Basis, Include, and Exclude lists.
</>
)
},
{
question: 'What is the Exclude members list?',
answer: 'A grouping\'s Exclude overrides automatic and manual membership by explicitly not including anyone listed here. It may be empty.'
},
{
question: 'What is the Basis?',
answer: 'A grouping\'s Basis is the portion of the grouping membership that is automatically updated. It may be empty.'
}
];

return (
<div className="container pt-10 pb-10">
<h2 className="text-center text-xl font-bold text-text-color pb-7">GENERAL INFORMATION</h2>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
{generalInfoItems.map((generalInfoItem, index) => (
<div key={index}>
<h3 className="text-text-color text-lg pb-1">{generalInfoItem.question}</h3>
<p>{generalInfoItem.answer}</p>
</div>
))}
</div>
</div>
);
};

export default GeneralInfoSection;
47 changes: 47 additions & 0 deletions ui/src/app/about/_components/TechnicalInfoSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const TechnicalInfoSection = () => {
const technicalInfoItems = [
{ name: 'React.js', url: 'https://react.dev/learn', description: '(Quickstart)' },
{ name: 'shadcn/ui', url: 'https://ui.shadcn.com/docs', description: '(Guide)' },
{ name: 'Jest', url: 'https://jestjs.io/docs/getting-started', description: '(Introduction)' },
{ name: 'Next.js', url: 'https://nextjs.org/docs', description: '(Introduction)' },
{ name: 'Tanstack Table', url: 'https://tanstack.com/table/v8/docs/introduction', description: '(Introduction)' },
{ name: 'React Testing Library', url: 'https://testing-library.com/', description: '(Documentation)' },
{ name: 'Typescript', url: 'https://www.typescriptlang.org/docs/', description: '(Guide)' },
{ name: 'Tanstack Query', url: 'https://tanstack.com/query/latest/docs/framework/react/overview', description: '(Guide)' },
{ name: '', url: '', description: ''},
{ name: 'Tailwind CSS', url: 'https://v2.tailwindcss.com/docs', description: '(Guide)' },
{ name: 'Iron Session', url: 'https://github.com/vvo/iron-session', description: '(GitHub)' }
];

return (
<div className="container pb-10 pt-6">
<h2 className="text-center text-text-color text-xl font-bold pb-7">TECHNICAL INFORMATION</h2>
<div className="grid grid-cols-1 md:grid-cols-4 gap-6">
<div className="col-span-1">
<h3 className="text-text-color text-lg pb-2">Resources</h3>
<p className="pb-3">Source code is available on <a
className="text-link-color hover:underline hover:text-link-hover-color"
href="https://github.com/uhawaii-system-its-ti-iam/uh-groupings">GitHub</a>
</p>
</div>
<div className="col-span-3">
<h3 className="text-text-color text-lg pb-2">Technologies</h3>
<div className="grid grid-cols-1 md:grid-cols-3 md:gap-4 gap-0">
{technicalInfoItems.map((item, index) => (
<div key={index} >
<p>
{item.name}&nbsp;
<a className="text-link-color hover:underline hover:text-link-hover-color" href={item.url} aria-label={`Link to ${item.name} ${item.description}`}>
{item.description}
</a>
</p>
</div>
))}
</div>
</div>
</div>
</div>
);
};

export default TechnicalInfoSection;
34 changes: 34 additions & 0 deletions ui/src/app/about/_components/WhatHappensIfSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const WhatHappensIfSection = () => {
const whatHappensIfItems = [
{
question: 'I was an owner of just one grouping and someone (me or another owner) deleted my ownership while I was still logged in.',
answer: 'You will still see the Groupings menu option, but you will get an error message when you click on it. Next time you log in, the Groupings menu option will no longer appear, assuming that you don\'t reacquire the ownership of a grouping before then.'
},
{
question: 'I was not an owner of any groupings and someone made me an owner while I was still logged in.',
answer: 'You will have to log out and then log back in again to see the Groupings menu option.'
},
{
question: 'I was an admin and someone (me or another admin) deleted my admin role while I was still logged in.',
answer: 'You will still see the Admin menu option, but you will get an error message when you click on it. Next time you log in, the Admin menu option will no longer appear, assuming that you don\'t reacquire the Admin role before then.'
}
];

return (
<div className="bg-seafoam pt-5">
<div className="container pb-10">
<h2 className="text-center text-xl text-text-color font-bold pb-7 pt-5">WHAT HAPPENS IF</h2>
<div className="grid gap-8">
{whatHappensIfItems.map((item, index) => (
<div key={index}>
<h3 className="text-text-color text-lg pb-2">Q: {item.question}</h3>
<p>A: {item.answer}</p>
</div>
))}
</div>
</div>
</div>
);
};

export default WhatHappensIfSection;
154 changes: 7 additions & 147 deletions ui/src/app/about/page.tsx
Original file line number Diff line number Diff line change
@@ -1,154 +1,14 @@
import UHGroupingsInfo from '@/components/UHGroupingsInfo';
import GeneralInfoSection from '@/app/about/_components/GeneralInfoSection';
import WhatHappensIfSection from '@/app/about/_components/WhatHappensIfSection';
import TechnicalInfoSection from '@/app/about/_components/TechnicalInfoSection';

const About = () => (
<main>
<UHGroupingsInfo/>
<div className="container pt-10 pb-10">
<h2 className="text-center text-xl font-bold text-text-color pb-7">GENERAL INFO</h2>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6 ">
<div className="col-span-1">
<h3 className="text-text-color text-lg pb-1">How do I request a new grouping?</h3>
<p className="pb-7">
<a className="text-link-color hover:underline hover:text-link-hover-color"
href={'https://uhawaii.atlassian.net/wiki/spaces/UHIAM/' +
'pages/13402308/UH+Groupings+Request+Form'}
aria-label="A request form is available">A request form is available
</a>.
</p>

<h3 className="text-text-color text-lg pb-1">Exactly what is a grouping?</h3>
<p className="pb-5">
<a className="text-link-color hover:underline hover:text-link-hover-color"
href="https://uhawaii.atlassian.net/wiki/spaces/UHIAM/pages/13403213/UH+Groupings"
aria-label="General information about groupings is available">General information about
groupings is available</a>.
A grouping&apos;s components include the Basis, Include, and Exclude lists.</p>

<h3 className="text-text-color text-lg pb-1">What is the Basis?</h3>
<p>A grouping&apos;s Basis is the portion of the grouping membership that
is automatically updated. It may be empty.</p>
</div>
<div className="col-span-1">
<h3 className="text-text-color text-lg pb-1">What is the Include members list?</h3>
<p className="pb-5">A grouping&apos;s Include is the portion of the grouping
membership that is
manually updated.
It may be empty.</p>
<h3 className="text-text-color text-lg pb-1">What is the Exclude members list?</h3>
<p className="pb-5">A grouping&apos;s Exclude overrides automatic
and manual membership by explicitly not including anyone listed here. It may be empty.</p>
</div>
</div>
</div>

<div className="bg-seafoam pt-5">
<div className="container pb-10">
<h2 className="text-center text-xl text-text-color font-bold pb-7 pt-5">WHAT HAPPENS IF</h2>
<div className="grid gap-8">
<div>
<h3 className="text-text-color text-lg pb-2">Q: I was an owner of just one grouping and
someone (me or another owner) deleted my ownership while I was still logged in.</h3>
<p>A: You will still see the Groupings menu option, but you will get an error message when
you click on it. Next time you log in, the Groupings menu option will no longer appear,
assuming that you don&apos;t reacquire the ownership of a grouping before then.</p>
</div>
<div>
<h3 className="text-text-color text-lg pb-2">Q: I was not an owner of any groupings and
someone made me an owner while I was still logged in.</h3>
<p>A: You will have to log out and then log back in again to see the
Groupings menu option.</p>
</div>
<div>
<h3 className="text-text-color text-lg pb-2">Q: I was an admin and someone
(me or another admin) deleted my admin role while I was still logged in.</h3>
<p>A: You will still see the Admin menu option, but you will get an error
message when you click on it. Next time you log in, the Admin menu option will no longer
appear, assuming that you don&apos;t reacquire the Admin role before then.</p>
</div>
</div>
</div>
</div>
<div className="container pb-10 pt-6">
<h2 className="text-center text-text-color text-xl font-bold pb-7">TECHNICAL INFORMATION</h2>
<div className="grid grid-cols-1 md:grid-cols-4 gap-6">
<div className="col-span-1">
<h3 className="text-text-color text-lg pb-2">Resources</h3>
<p className="pb-3">Source code is available on <a
className="text-link-color hover:underline hover:text-link-hover-color"
href="https://github.com/uhawaii-system-its-ti-iam/uh-groupings">GitHub</a>
</p>
</div>

<div className="col-span-3">
<h3 className="text-text-color text-lg pb-2">Technologies</h3>
<div className="grid grid-cols-1 md:grid-cols-3 md:gap-4 gap-0">
<div className="col-span-1">
<p className="pb-4">React.js&nbsp;
<a className="text-link-color hover:underline hover:text-link-hover-color"
href="https://react.dev/learn"
aria-label="Link to React.js Quickstart"
>(Quickstart)</a></p>
<p className="pb-4">Next.js&nbsp;
<a className="text-link-color hover:underline hover:text-link-hover-color"
href="https://nextjs.org/docs"
aria-label="Link to Next.js Introduction"
>(Introduction)</a></p>
<p className="pb-4">Typescript&nbsp;
<a className="text-link-color hover:underline hover:text-link-hover-color"
href="https://www.typescriptlang.org/docs/"
aria-label="Link to Typescript Guide"
>(Guide)</a>
</p>
<p className="pb-4">Tailwind CSS&nbsp;
<a className="text-link-color hover:underline hover:text-link-hover-color"
href="https://v2.tailwindcss.com/docs"
aria-label="Link to Tailwind CSS Guide"
>(Guide)</a>
</p>
</div>
<div className="col-span-1">
<p className="pb-4">shadcn/ui&nbsp;
<a className="text-link-color hover:underline hover:text-link-hover-color"
href="https://ui.shadcn.com/docs"
aria-label="Link to shadcn/ui Guide"
>(Guide)</a></p>
<p className="pb-4">Tanstack Table&nbsp;
<a className="text-link-color hover:underline hover:text-link-hover-color"
href="https://tanstack.com/table/v8/docs/introduction"
aria-label="Link to Tanstack Table Introduction"
>(Introduction)</a>
</p>
<p className="pb-4">Tanstack Query&nbsp;
<a className="text-link-color hover:underline hover:text-link-hover-color"
href="https://tanstack.com/query/latest/docs/framework/react/overview"
aria-label="Link to Tanstack Query Guide"
>(Guide)</a>
</p>
<p className="pb-4">Iron Session&nbsp;
<a className="text-link-color hover:underline hover:text-link-hover-color"
href="https://github.com/vvo/iron-session"
aria-label="Link to Iron Session GitHub"
>(GitHub)</a>
</p>
</div>
<div className="col-span-1">
<p className="pb-4">Jest&nbsp;
<a className="text-link-color hover:underline hover:text-link-hover-color"
href="https://jestjs.io/docs/getting-started"
aria-label="Link to Jest Introduction"
>(Introduction)</a>
</p>
<p className="pb-4">React Testing Library&nbsp;
<a className="text-link-color hover:underline hover:text-link-hover-color"
href="https://testing-library.com/"
aria-label="Link to React Testing Library Documentation"
>(Documentation)</a>
</p>
</div>
</div>
</div>
</div>
</div>
<UHGroupingsInfo />
<GeneralInfoSection />
<WhatHappensIfSection />
<TechnicalInfoSection />
</main>
);

Expand Down
24 changes: 24 additions & 0 deletions ui/tests/app/about/_components/GeneralInfoSection.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { render, screen } from '@testing-library/react';
import GeneralInfoSection from '@/app/about/_components/GeneralInfoSection';

describe('GeneralInfoSection', () => {
it('should render with question and answer', () => {
render(<GeneralInfoSection />);

expect(screen.getByText('How do I request a new grouping?')).toBeInTheDocument();
expect(screen.getByText('A request form is available.')).toBeInTheDocument();

expect(screen.getByText('What is the Include members list?')).toBeInTheDocument();
expect(screen.getByText('A grouping\'s Include is the portion of the grouping membership that is manually updated. It may be empty.')).toBeInTheDocument();

expect(screen.getByText('Exactly what is a grouping?')).toBeInTheDocument();
expect(screen.getByText('General information about groupings is available.')).toBeInTheDocument();
expect(screen.getByText('A grouping\'s components include the Basis, Include, and Exclude lists.')).toBeInTheDocument();

expect(screen.getByText('What is the Exclude members list?')).toBeInTheDocument();
expect(screen.getByText('A grouping\'s Exclude overrides automatic and manual membership by explicitly not including anyone listed here. It may be empty.')).toBeInTheDocument();

expect(screen.getByText('What is the Basis?')).toBeInTheDocument();
expect(screen.getByText('A grouping\'s Basis is the portion of the grouping membership that is automatically updated. It may be empty.')).toBeInTheDocument();
});
});
Loading

0 comments on commit 62b78d3

Please sign in to comment.