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

[Feature] main site navigation #11501

Merged
merged 83 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
fd7142d
Rough out main site navigation
Aug 29, 2024
486950b
Refactor notification layout
Aug 30, 2024
ab961fa
Merge branch 'main' into 10793-main-site-navigation
Sep 4, 2024
41994f4
Add back nav links by roll and fix styling
Sep 9, 2024
658f67b
More refactoring
Sep 11, 2024
e9d3196
Merge branch 'main' into 10793-main-site-navigation
Sep 11, 2024
9822d85
Add theme switch and lang switch
Sep 11, 2024
64dc12f
Fix some linting errors
Sep 11, 2024
620e670
Merge branch 'main' into 10793-main-site-navigation
Sep 17, 2024
75e71ae
Fix layout and add routes
Sep 17, 2024
c504c43
Merge branch 'main' into 10793-main-site-navigation
Sep 18, 2024
60a9556
Remove old story
Sep 18, 2024
464c79b
More routing changes
Sep 19, 2024
04c87fe
Merge branch 'main' into 10793-main-site-navigation
Sep 24, 2024
e498660
Fix home page reload bug
Sep 24, 2024
b00019f
Add manager homepage nav link with roles
Sep 24, 2024
76c9d98
Consolidate admin layout and main layout
Sep 25, 2024
d4d0a0c
Fix mobile menu not closing on select
Sep 25, 2024
9308413
Merge branch 'main' into 10793-main-site-navigation
Sep 26, 2024
caeb424
Fix mobile scroll
Sep 26, 2024
b9dd93c
Fix mobile view and remove themeswitch and langswitch on mobile view
Sep 26, 2024
47aaf98
Fix lint errors
Sep 26, 2024
a1d86cd
Add Flourish
Sep 26, 2024
c6ed5cf
Merge branch 'main' into 10793-main-site-navigation
Oct 7, 2024
5a84068
Fix manager role var name
Oct 8, 2024
a97ab34
Rename navLinks to useMainNavLinks and add default export
Oct 8, 2024
6bd1b87
Add community home page
Oct 8, 2024
2509760
Remove uneeded auth roles from admin dashboard page
Oct 8, 2024
90bfafc
Remove remove scroll tool from nav menu
Oct 8, 2024
7d84bc3
Revert prevNav to localStorage setup
Oct 8, 2024
359e25d
Store navRole in localeStorage
Oct 8, 2024
54d20e6
Add missing hrefs to community main links
Oct 8, 2024
bb48bd8
Fix layout default export identifier error
Oct 8, 2024
d69b8c5
Remove uneeded useEffect and useState
Oct 8, 2024
9ee5090
Remove type cast and add localization
Oct 8, 2024
f37a42a
Remove open/close on hover
Oct 8, 2024
a1b3c03
Remove nav_role when logged out
Oct 8, 2024
738d62b
Remove todo
Oct 8, 2024
86c8b75
Fix community routing
Oct 8, 2024
cfe389a
Remove duplicate export
Oct 8, 2024
ab92a9c
Fix manager homepage export naming
Oct 8, 2024
984c41e
Fix manager homepage export naming again
Oct 8, 2024
6d7b836
Merge branch 'main' into 10793-main-site-navigation
Oct 9, 2024
9ee1f5d
Merge branch 'main' into 10793-main-site-navigation
Oct 17, 2024
61678be
Remove guest role
Oct 17, 2024
88c420b
Simplify roleNames type
Oct 17, 2024
1ea6670
Refactor roleLinks function
Oct 17, 2024
76adab3
Update auth roles on account settings page
Oct 17, 2024
e61ea6d
Fix notification panel preventing close event
Oct 17, 2024
67e69bf
Add gap btw sticky nav and sidebar
Oct 17, 2024
6c1ca1c
Fix seperator height
Oct 17, 2024
c0a75d8
Make role name key explicit and add to import index
Oct 17, 2024
a9affa9
Merge branch 'main' into 10793-main-site-navigation
Oct 18, 2024
25203c5
Remove your account separator when not logged in
Oct 18, 2024
5f6352b
Fix playwright tests
Oct 21, 2024
1316c19
Merge branch 'main' into 10793-main-site-navigation
Oct 21, 2024
86e04a3
Remove duplicate route
Oct 22, 2024
1088229
Fix font color styling
Oct 22, 2024
274e044
Merge branch 'main' into 10793-main-site-navigation
Oct 22, 2024
c732892
Fix opacity of notification panel
Oct 22, 2024
1420636
Fix notification dialog opacity animation
Oct 23, 2024
63b729f
Update visible links by role
Oct 23, 2024
423bb95
Update useBreadcrumbs home links by role
Oct 23, 2024
0781b19
Merge branch 'main' into 10793-main-site-navigation
Oct 23, 2024
0a0a2b8
Merge branch 'main' into 10793-main-site-navigation
Oct 24, 2024
330eb24
Move permission constants into hook
Oct 24, 2024
99454a6
Add new resource and system settings sub menus
Oct 24, 2024
d98ce5d
Merge branch 'main' into 10793-main-site-navigation
Oct 25, 2024
f196792
Update and fix design
Oct 28, 2024
654171e
Change permissions hook to constants list
Oct 28, 2024
6e53cb6
Fix lint
Oct 28, 2024
88ab72c
Merge branch 'main' into 10793-main-site-navigation
Oct 28, 2024
fe2790e
Add first round of translations
Oct 29, 2024
34fa5f1
Merge branch 'main' into 10793-main-site-navigation
Oct 29, 2024
1c9b705
Fix missing nav_role while logged in bug
Oct 30, 2024
7a5c31a
Fix styling
Oct 30, 2024
922f17c
Merge branch 'main' into 10793-main-site-navigation
Oct 30, 2024
f0d56bf
Fix border color
Oct 30, 2024
c983f35
Add translations
Oct 30, 2024
5662785
Last styling changes
Oct 30, 2024
e5bd1c3
Remove isAdmin from breadcrumbs hook
Oct 30, 2024
fd3bae3
Merge branch 'main' into 10793-main-site-navigation
Oct 31, 2024
18e3777
Vertically align nav role sub menu trigger
Oct 31, 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
1 change: 1 addition & 0 deletions api/app/Enums/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ enum Role: string
{
case BASE_USER = 'base_user';
case APPLICANT = 'applicant';
case MANAGER = 'manager';
case POOL_OPERATOR = 'pool_operator';
case REQUEST_RESPONDER = 'request_responder';
case COMMUNITY_RECRUITER = 'community_recruiter';
Expand Down
12 changes: 9 additions & 3 deletions apps/playwright/tests/admin/auth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ test.describe("Authenticated", () => {

test("Can logout", async ({ applicantPage }) => {
await applicantPage.gotoHome();
await applicantPage.page
.getByRole("button", { name: "your account" })
.click();
await applicantPage.page.getByRole("button", { name: /sign out/i }).click();
const logoutDialog = applicantPage.page.getByRole("alertdialog", {
name: /sign out/i,
Expand Down Expand Up @@ -150,6 +153,7 @@ test.describe("Authenticated", () => {

test.describe("Process operator", () => {
const processOperatorRestrictedPaths = [
"/en/admin",
"/en/admin/users",
"/en/admin/settings/announcements",
"/en/admin/settings/classifications",
Expand All @@ -162,7 +166,7 @@ test.describe("Authenticated", () => {
"/en/admin/pool-candidates",
];

const processOperatorAllowedPaths = ["/en/admin", "/en/admin/pools"];
const processOperatorAllowedPaths = ["/en/community", "/en/admin/pools"];

test("user accesses allowed paths only", async ({
processOperatorPage,
Expand Down Expand Up @@ -201,6 +205,7 @@ test.describe("Authenticated", () => {

test.describe("Community recruiter", () => {
const communityRecruiterRestrictedPaths = [
"/en/admin",
"/en/admin/users",
"/en/admin/settings/announcements",
"/en/admin/settings/classifications",
Expand All @@ -212,7 +217,7 @@ test.describe("Authenticated", () => {
];

const communityRecruiterAllowedPaths = [
"/en/admin",
"/en/community",
"/en/admin/pools",
"/en/admin/talent-requests",
"/en/admin/communities",
Expand Down Expand Up @@ -255,6 +260,7 @@ test.describe("Authenticated", () => {

test.describe("Community admin", () => {
const communityAdminRestrictedPaths = [
"/en/admin",
"/en/admin/users",
"/en/admin/settings/announcements",
"/en/admin/settings/classifications",
Expand All @@ -266,7 +272,7 @@ test.describe("Authenticated", () => {
];

const communityAdminAllowedPaths = [
"/en/admin",
"/en/community",
"/en/admin/pools",
"/en/admin/talent-requests",
"/en/admin/communities",
Expand Down
1 change: 1 addition & 0 deletions apps/playwright/tests/login-logout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ test.describe("Login and logout", () => {
// visit somewhere in second page context
// and make sure we are logged in
await pageTwo.goto("/en/");
await pageTwo.getByRole("button", { name: "your account" }).click();
await expect(
pageTwo.getByRole("button", { name: /sign out/i }),
).toBeVisible();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface AdminContentWrapperProps {
}

const AdminContentWrapper = ({ children }: AdminContentWrapperProps) => (
<div data-h2-wrapper="base(center, full, x2)">
<div data-h2-wrapper="base(center, large, x1) p-tablet(center, large, x2)">
<div data-h2-padding="base(0, 0, x3, 0)">{children}</div>
</div>
);
Expand Down
60 changes: 33 additions & 27 deletions apps/web/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
oppositeLocale,
useLocale,
} from "@gc-digital-talent/i18n";
import { useIsSmallScreen } from "@gc-digital-talent/helpers";

import { GocLogoEn, GocLogoFr, GocLogoWhiteEn, GocLogoWhiteFr } from "../Svg";
import ThemeSwitcher from "../ThemeSwitcher/ThemeSwitcher";
Expand All @@ -31,6 +32,9 @@ const Header = ({ width }: HeaderProps) => {
"data-h2-wrapper": "base(center, full, x1) p-tablet(center, full, x2)",
};
}

const isSmallScreen = useIsSmallScreen(1080);

return (
<header
data-h2-background-color="base(foreground) base:dark(white)"
Expand Down Expand Up @@ -83,34 +87,36 @@ const Header = ({ width }: HeaderProps) => {
</span>
</a>
</div>
<div
data-h2-display="base(flex)"
data-h2-flex-direction="base(column) p-tablet(row)"
data-h2-gap="base(x.5) p-tablet(x1)"
data-h2-align-items="base(center)"
data-h2-justify-content="base(center) p-tablet(flex-end)"
data-h2-text-align="base(center) p-tablet(left)"
>
<div>
<ThemeSwitcher />
</div>
<div>
<a
data-h2-background-color="base:focus-visible(focus)"
data-h2-outline="base(none)"
data-h2-color="base:hover(secondary.darker) base:focus-visible(black)"
href={languageTogglePath}
lang={changeToLang === "en" ? "en" : "fr"}
>
{intl.formatMessage({
defaultMessage:
"<hidden>Changer la langue en </hidden>Français",
id: "Z3h103",
description: "Title for the language toggle link.",
})}
</a>
{!isSmallScreen && (
<div
data-h2-display="base(flex)"
data-h2-flex-direction="base(column) p-tablet(row)"
data-h2-gap="base(x.5) p-tablet(x1)"
data-h2-align-items="base(center)"
data-h2-justify-content="base(center) p-tablet(flex-end)"
data-h2-text-align="base(center) p-tablet(left)"
>
<div>
<ThemeSwitcher />
</div>
<div>
<a
data-h2-background-color="base:focus-visible(focus)"
data-h2-outline="base(none)"
data-h2-color="base:hover(secondary.darker) base:focus-visible(black)"
href={languageTogglePath}
lang={changeToLang === "en" ? "en" : "fr"}
>
{intl.formatMessage({
defaultMessage:
"<hidden>Changer la langue en </hidden>Français",
id: "Z3h103",
description: "Title for the language toggle link.",
})}
</a>
</div>
</div>
</div>
)}
</div>
</div>
</header>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/HeroDeprecated/AdminHero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const AdminHero = ({
data-h2-background="base(linear-gradient(92deg, rgba(175, 103, 255, 0.10) 1.42%, rgba(0, 195, 183, 0.10) 98.58%))"
data-h2-margin-bottom="base(x3)"
>
<div data-h2-wrapper="base(center, full, x1) base(center, full, x2)">
<div data-h2-wrapper="base(center, large, x1) p-tablet(center, large, x2)">
<div data-h2-color="base(black)" data-h2-padding="base(x2 0)">
<div
data-h2-display="base(flex)"
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/HeroDeprecated/AdminSubNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export interface AdminSubNavProps {

const AdminSubNav = ({ mode, items }: AdminSubNavProps) => {
if (mode === "crumbs") {
return <Breadcrumbs crumbs={items} fullWidth />;
return <Breadcrumbs crumbs={items} />;
}

return (
<NavTabs.Root>
<NavTabs.List data-h2-wrapper="base(center, full, x1) base(center, full, x2)">
<NavTabs.List data-h2-wrapper="base(center, large, x1) p-tablet(center, large, x2)">
{items.map((item) => (
<NavTabs.Item key={item.url}>
<NavTabs.Link href={item.url}>{item.label}</NavTabs.Link>
Expand Down
Loading
Loading