Skip to content

Commit

Permalink
fix: Apply prettier for scr/app
Browse files Browse the repository at this point in the history
  • Loading branch information
flozia committed Jun 20, 2023
1 parent 8576145 commit 9cf79b6
Show file tree
Hide file tree
Showing 28 changed files with 564 additions and 396 deletions.
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ src/db/**/*.js
# These files are remnants of our Express app:
src/app.js
src/appConstants.js
src/app/
src/routes/
src/client/
src/views/
Expand Down
49 changes: 34 additions & 15 deletions src/app/(nextjs_migration)/(authenticated)/user/breaches/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,26 +119,37 @@ export default async function UserBreaches() {
});

return (
<details key={breach.Name + account.email} className='breach-row' data-status={status} data-email={account.email} data-classes={dataClassesTranslated} hidden={isHidden}>
<details
key={breach.Name + account.email}
className="breach-row"
data-status={status}
data-email={account.email}
data-classes={dataClassesTranslated}
hidden={isHidden}
>
<summary>
<span className='breach-company'><BreachLogo breach={breach} logos={breachLogos} /> {breach.Title}</span>
<span className="breach-company">
<BreachLogo breach={breach} logos={breachLogos} />{" "}
{breach.Title}
</span>
<span>{shortList.format(dataClassesTranslated)}</span>
<span>
<span className='resolution-badge is-resolved'>{l10n.getString(
"column-status-badge-resolved"
)}</span>
<span className='resolution-badge is-active'>{l10n.getString(
"column-status-badge-active"
)}</span>
<span className="resolution-badge is-resolved">
{l10n.getString("column-status-badge-resolved")}
</span>
<span className="resolution-badge is-active">
{l10n.getString("column-status-badge-active")}
</span>
</span>
<span>{shortDate.format(addedDate)}</span>
</summary>
<article>
<p>{description}</p>
<p><strong>{l10n.getString(
"breaches-resolve-heading"
)}</strong></p>
<ol className='resolve-list'
<p>
<strong>{l10n.getString("breaches-resolve-heading")}</strong>
</p>
<ol
className="resolve-list"
dangerouslySetInnerHTML={{ __html: createResolveSteps(breach) }}
/>
</article>
Expand All @@ -158,9 +169,17 @@ export default async function UserBreaches() {
<Script type="module" src="/nextjs_migration/client/js/dialog.js" />
<main data-partial="breaches">
<section>
{(process.env.PREMIUM_ENABLED === "true" && !session?.user.fxa?.subscriptions?.includes("monitor")) ?
<a className="button primary" href={process.env.SUBSCRIBE_PREMIUM_URL}>Subscribe to Premium</a>
: ''}
{process.env.PREMIUM_ENABLED === "true" &&
!session?.user.fxa?.subscriptions?.includes("monitor") ? (
<a
className="button primary"
href={process.env.SUBSCRIBE_PREMIUM_URL}
>
Subscribe to Premium
</a>
) : (
""
)}
</section>
<section>
<header className="breaches-header">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ function getBreachDetail(categoryId: ReturnType<typeof getBreachCategory>) {
}
}

function makeBreachDetail(breachCategory: ReturnType<typeof getBreachCategory>) {
function makeBreachDetail(
breachCategory: ReturnType<typeof getBreachCategory>
) {
const breachDetail = getBreachDetail(breachCategory);
return (
<>
Expand Down
11 changes: 6 additions & 5 deletions src/app/(nextjs_migration)/(guest)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ export default async function Home() {

return (
<div data-partial="landing">
<script type="module" src="/nextjs_migration/client/js/transitionObserver.js" async></script>
<script
type="module"
src="/nextjs_migration/client/js/transitionObserver.js"
async
></script>
<Script type="module" src="/nextjs_migration/client/js/landing.js" />
<section className="hero">
<div>
Expand Down Expand Up @@ -107,10 +111,7 @@ export default async function Home() {
</figure>
</section>

<section
className="top-questions-about-monitor"
data-enter-transition
>
<section className="top-questions-about-monitor" data-enter-transition>
<div>
<h2>{l10n.getString("top-questions-about-monitor")}</h2>
<a
Expand Down
6 changes: 5 additions & 1 deletion src/app/(nextjs_migration)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ export default async function MigrationLayout({
const l10nBundles = getL10nBundles();
return (
<L10nProvider bundleSources={l10nBundles}>
<script type="module" src="/nextjs_migration/client/js/resizeObserver.js" async />
<script
type="module"
src="/nextjs_migration/client/js/resizeObserver.js"
async
/>
<Script type="module" src="/nextjs_migration/client/js/analytics.js" />
{children}
</L10nProvider>
Expand Down
4 changes: 2 additions & 2 deletions src/app/(proper_react)/MobileShell.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@
text-decoration: underline;
}

// The `a` and `a:visited` violate this rule, but are safe:
// stylelint-disable-next-line no-descending-specificity
// The `a` and `a:visited` violate this rule, but are safe:
// stylelint-disable-next-line no-descending-specificity
&:focus {
background-color: $color-blue-50;
color: $color-white;
Expand Down
2 changes: 1 addition & 1 deletion src/app/(proper_react)/Shell.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Story = StoryObj<typeof ShellEl>;
export const Shell: Story = {
render: () => (
<ShellEl l10n={getL10n()} session={null}>
<div style={{height: 800}}></div>
<div style={{ height: 800 }}></div>
</ShellEl>
),
};
2 changes: 1 addition & 1 deletion src/app/(proper_react)/Shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ export const Shell = (props: Props) => {
</div>
</MobileShell>
);
}
};
2 changes: 1 addition & 1 deletion src/app/[slug]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function GET(req: NextRequest) {
// Note: we do not `await` this Promise, to ensure we do not delay sending
// the heartbeat response while we are still fetching the data.
// TODO: Replace with a cron job to fetch breach data and icons.
getBreaches().then(breaches => getBreachIcons(breaches));
getBreaches().then((breaches) => getBreachIcons(breaches));
return NextResponse.json({ success: true, message: "OK" }, { status: 200 });
}

Expand Down
18 changes: 9 additions & 9 deletions src/app/api/utils/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
import { NextRequest } from "next/server";

export function bearerToken(req: NextRequest) {
const requestHeaders = new Headers(req.headers)
requestHeaders.get('authorization')
const authHeader = requestHeaders.get('authorization')
const requestHeaders = new Headers(req.headers);
requestHeaders.get("authorization");
const authHeader = requestHeaders.get("authorization");

// Require an auth header
if (!authHeader) {
throw new Error('No auth header found');
throw new Error("No auth header found");
}

// Extract the first portion which should be 'Bearer'
const headerType = authHeader.substring(0, authHeader.indexOf(' '))
if (headerType !== 'Bearer') {
throw new Error('Invalid auth type');
const headerType = authHeader.substring(0, authHeader.indexOf(" "));
if (headerType !== "Bearer") {
throw new Error("Invalid auth type");
}

// The remaining portion, which should be the token
return authHeader.substring(authHeader.indexOf(' ') + 1)
}
return authHeader.substring(authHeader.indexOf(" ") + 1);
}
6 changes: 5 additions & 1 deletion src/app/api/utils/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import { getTemplate } from "../../../views/emails/email2022.js";
import { verifyPartial } from "../../../views/emails/emailVerify.js";
import { Subscriber } from "../../(nextjs_migration)/(authenticated)/user/breaches/breaches";

export async function sendVerificationEmail(user: Subscriber, emailId: string, l10n: ReactLocalization) {
export async function sendVerificationEmail(
user: Subscriber,
emailId: string,
l10n: ReactLocalization
) {
const getMessage = getStringLookup(l10n);
const unverifiedEmailAddressRecord = await resetUnverifiedEmailAddress(
emailId,
Expand Down
Loading

0 comments on commit 9cf79b6

Please sign in to comment.