Skip to content

Commit

Permalink
feat: establish redirection for legal documents
Browse files Browse the repository at this point in the history
  • Loading branch information
bripkens committed Oct 26, 2023
1 parent 2bc81ce commit c06c19a
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default function RootLayout({ children }: PropsWithChildren) {
<html lang="en" className="dark overflow-hidden">
<head>
<meta name="viewport" content="initial-scale=1" />
<link rel="preload" href="/validation/supported-distributions" as="fetch" crossOrigin="anonymous" />
</head>
<body
className={cn("max-h-screen min-h-screen min-w-[64rem] bg-background font-sans antialiased", inter.className)}
Expand Down
12 changes: 12 additions & 0 deletions src/app/policies/acceptable-use/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-FileCopyrightText: 2023 Dash0 Inc.
// SPDX-License-Identifier: Apache-2.0

import { NextResponse } from "next/server";
import { notFound } from "next/navigation";

export function GET(): NextResponse {
if (process.env.NEXT_PUBLIC_ACCEPTABLE_USE_URL) {
return NextResponse.redirect(process.env.NEXT_PUBLIC_ACCEPTABLE_USE_URL);
}
notFound();
}
12 changes: 12 additions & 0 deletions src/app/policies/cookies/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-FileCopyrightText: 2023 Dash0 Inc.
// SPDX-License-Identifier: Apache-2.0

import { NextResponse } from "next/server";
import { notFound } from "next/navigation";

export function GET(): NextResponse {
if (process.env.NEXT_PUBLIC_COOKIE_POLICY_URL) {
return NextResponse.redirect(process.env.NEXT_PUBLIC_COOKIE_POLICY_URL);
}
notFound();
}
12 changes: 12 additions & 0 deletions src/app/policies/privacy/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-FileCopyrightText: 2023 Dash0 Inc.
// SPDX-License-Identifier: Apache-2.0

import { NextResponse } from "next/server";
import { notFound } from "next/navigation";

export function GET(): NextResponse {
if (process.env.NEXT_PUBLIC_PRIVACY_POLICY_URL) {
return NextResponse.redirect(process.env.NEXT_PUBLIC_PRIVACY_POLICY_URL);
}
notFound();
}
12 changes: 12 additions & 0 deletions src/app/policies/terms/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-FileCopyrightText: 2023 Dash0 Inc.
// SPDX-License-Identifier: Apache-2.0

import { NextResponse } from "next/server";
import { notFound } from "next/navigation";

export function GET(): NextResponse {
if (process.env.NEXT_PUBLIC_TERMS_AND_CONDITIONS_URL) {
return NextResponse.redirect(process.env.NEXT_PUBLIC_TERMS_AND_CONDITIONS_URL);
}
notFound();
}
16 changes: 9 additions & 7 deletions src/components/legal/LegalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ export function LegalContent() {
return (
<div>
<ul className="mx-4 my-3 text-sm font-normal text-subtl">
{legalDocuments.map((doc) => (
<li key={doc.label}>
<a href={doc.url} target="_blank" className="hover:text-default">
{doc.label}
</a>
</li>
))}
{legalDocuments
.filter((doc) => Boolean(doc.url))
.map((doc) => (
<li key={doc.label}>
<a href={doc.url!} target="_blank" className="hover:text-default">
{doc.label}
</a>
</li>
))}
</ul>
</div>
);
Expand Down
8 changes: 4 additions & 4 deletions src/components/legal/legalDocuments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
export const legalDocuments = [
{
label: "Terms and Conditions",
url: process.env.NEXT_PUBLIC_TERMS_AND_CONDITIONS_URL,
url: process.env.NEXT_PUBLIC_TERMS_AND_CONDITIONS_URL ? "/policies/terms" : null,
},
{
label: "Privacy Policy",
url: process.env.NEXT_PUBLIC_PRIVACY_POLICY_URL,
url: process.env.NEXT_PUBLIC_PRIVACY_POLICY_URL ? "/policies/privacy" : null,
},
{
label: "Cookie Policy",
url: process.env.NEXT_PUBLIC_COOKIE_POLICY_URL,
url: process.env.NEXT_PUBLIC_COOKIE_POLICY_URL ? "/policies/cookies" : null,
},
{
label: "Acceptable Use Policy",
url: process.env.NEXT_PUBLIC_ACCEPTABLE_USE_URL,
url: process.env.NEXT_PUBLIC_ACCEPTABLE_USE_URL ? "/policies/acceptable-use" : null,
},
];
5 changes: 0 additions & 5 deletions src/components/validation-type/BackendValidation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@ import { useDistributions } from "../validation/useDistributions";
import OtelLogo from "./../assets/svg/otel.svg";
import { Github, Globe } from "lucide-react";
import { Button } from "../button";
import { preload } from "swr";
import { IconButton } from "../icon-button";
import { CurrentBadge } from "./ValidationTypeContent";
import type { ICurrentValidation } from "./ValidationType";
import { useState } from "react";

const fetcher = (url: string) => fetch(url).then((res) => res.json());

preload(`https://www.otelbin.io/validation/supported-distributions`, fetcher);

export default function BackendValidation({
current,
setCurrent,
Expand Down

0 comments on commit c06c19a

Please sign in to comment.