-
Notifications
You must be signed in to change notification settings - Fork 16
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
[Issue #3247] logged in header #3458
Changes from 15 commits
0204314
735106c
b154c3d
03921ff
89dc193
f648391
39642aa
c6b5dc5
a921944
c924df9
0ae107a
c77d8a2
f7aee84
f0a44b7
5fd25dd
7b71b55
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,18 @@ | ||
"use client"; | ||
|
||
import { useFeatureFlags } from "src/hooks/useFeatureFlags"; | ||
import { useUser } from "src/services/auth/useUser"; | ||
|
||
import React from "react"; | ||
import { Button, Table } from "@trussworks/react-uswds"; | ||
|
||
import Loading from "src/components/Loading"; | ||
|
||
/** | ||
* View for managing feature flags | ||
*/ | ||
export default function FeatureFlagsTable() { | ||
const { setFeatureFlag, featureFlags } = useFeatureFlags(); | ||
const { user, isLoading, error } = useUser(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. with a working header we no longer need these changes on the feature flag page as a proof of concept |
||
|
||
if (isLoading) { | ||
return <Loading />; | ||
} | ||
|
||
if (error) { | ||
// there's no error page within this tree, should we make a top level error? | ||
return ( | ||
<> | ||
<h1>Error</h1> | ||
{error.message} | ||
</> | ||
); | ||
} | ||
|
||
return ( | ||
<> | ||
<h2> | ||
{user?.token ? `Logged in with token: ${user.token}` : "Not logged in"} | ||
</h2> | ||
<Table> | ||
<thead> | ||
<tr> | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,12 @@ import { getSession } from "src/services/auth/session"; | |
|
||
import { NextResponse } from "next/server"; | ||
|
||
export const revalidate = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't want to cache anything here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if this has an effect since a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also wondering if this is better as a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, I had this in there just for safety, but I just verified and the 'no-store' on the fetch call is doing all the work. We can safely pull this out. As for POST vs GET, I'm not sure I see a reason to make a change, but we can discuss |
||
|
||
export async function GET() { | ||
const currentSession = await getSession(); | ||
if (currentSession) { | ||
return NextResponse.json({ | ||
token: currentSession.token, | ||
}); | ||
return NextResponse.json(currentSession); | ||
} else { | ||
return NextResponse.json({ token: "" }); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import UserProvider from "src/services/auth/UserProvider"; | ||
|
||
import { useTranslations } from "next-intl"; | ||
import { setRequestLocale } from "next-intl/server"; | ||
|
||
|
@@ -17,16 +19,18 @@ export default function Layout({ children, locale }: Props) { | |
|
||
return ( | ||
// Stick the footer to the bottom of the page | ||
<div className="display-flex flex-column minh-viewport"> | ||
<a className="usa-skipnav z-top" href="#main-content"> | ||
{t("Layout.skip_to_main")} | ||
</a> | ||
<Header locale={locale} /> | ||
<main id="main-content" className="border-top-0"> | ||
{children} | ||
</main> | ||
<Footer /> | ||
<GrantsIdentifier /> | ||
</div> | ||
<UserProvider> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we could be more targeted here, but I don't see a need |
||
<div className="display-flex flex-column minh-viewport"> | ||
<a className="usa-skipnav" href="#main-content"> | ||
{t("Layout.skip_to_main")} | ||
</a> | ||
<Header locale={locale} /> | ||
<main id="main-content" className="border-top-0"> | ||
{children} | ||
</main> | ||
<Footer /> | ||
<GrantsIdentifier /> | ||
</div> | ||
</UserProvider> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import clsx from "clsx"; | ||
|
||
import SpriteSVG from "public/img/uswds-sprite.svg"; | ||
|
||
interface IconProps { | ||
name: string; | ||
className: string; | ||
className?: string; | ||
height?: string; | ||
} | ||
|
||
|
@@ -12,7 +14,7 @@ const sprite_uri = SpriteSVG.src as string; | |
export function USWDSIcon(props: IconProps) { | ||
return ( | ||
<svg | ||
className={props.className} | ||
className={clsx("usa-icon", props.className)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since all usage of this component had this class added manually, figured we should add it to the shared implementation and make this component a bit more useful. Removal of "usa-icon" from other files is a result of this change |
||
aria-hidden="true" | ||
height={props.height} | ||
role="img" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,7 @@ const OpportunityStatusWidget = ({ opportunityData }: Props) => { | |
switch (status) { | ||
case "archived": | ||
return ( | ||
<div className="usa-tag bg-base-lighter text-ink border-radius-2 border-base-lightest width-100 radius-md margin-right-0 font-sans-sm text-center text-no-uppercase"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. width-100 isn't a valid uswds class |
||
<div className="usa-tag bg-base-lighter text-ink border-radius-2 border-base-lightest radius-md margin-right-0 font-sans-sm text-center text-no-uppercase"> | ||
<p> | ||
<strong>{t("archived")}</strong> | ||
<span>{formatDate(archiveDate) || "--"}</span> | ||
|
@@ -71,7 +71,7 @@ const OpportunityStatusWidget = ({ opportunityData }: Props) => { | |
); | ||
case "closed": | ||
return ( | ||
<div className="usa-tag bg-base-lighter text-ink border-radius-2 border-base-lightest width-100 radius-md margin-right-0 font-sans-sm text-center text-no-uppercase"> | ||
<div className="usa-tag bg-base-lighter text-ink border-radius-2 border-base-lightest radius-md margin-right-0 font-sans-sm text-center text-no-uppercase"> | ||
<p> | ||
<strong>{t("closed")}</strong> | ||
<span>{formatDate(closeDate) || "--"}</span> | ||
|
@@ -81,7 +81,7 @@ const OpportunityStatusWidget = ({ opportunityData }: Props) => { | |
case "posted": | ||
return ( | ||
<> | ||
<div className="usa-tag bg-accent-warm-dark width-100 radius-md margin-right-0 font-sans-sm text-center text-no-uppercase"> | ||
<div className="usa-tag bg-accent-warm-dark radius-md margin-right-0 font-sans-sm text-center text-no-uppercase"> | ||
<p> | ||
<strong>{t("closing")}</strong> | ||
<span>{formatDate(closeDate) || "--"}</span> | ||
|
@@ -96,7 +96,7 @@ const OpportunityStatusWidget = ({ opportunityData }: Props) => { | |
); | ||
case "forecasted": | ||
return ( | ||
<div className="usa-tag bg-base-dark border-radius-2 width-100 radius-md margin-right-0 font-sans-sm text-center text-no-uppercase"> | ||
<div className="usa-tag bg-base-dark border-radius-2 radius-md margin-right-0 font-sans-sm text-center text-no-uppercase"> | ||
<p> | ||
<strong>{t("forecasted")}</strong> | ||
</p> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It occurs to me we should update the dev docs for the auth work, created a separate ticket #3474