Skip to content

Commit

Permalink
Merge branch 'main' into PPF-57/sent-reminder-email
Browse files Browse the repository at this point in the history
  • Loading branch information
grubolsch authored Sep 19, 2024
2 parents 775c8ec + 128e8e4 commit c772d0e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 26 deletions.
37 changes: 25 additions & 12 deletions resources/ts/Components/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { useIsAuthenticated } from "../hooks/useIsAuthenticated";
type Page = {
key: string;
component?: string;
shouldShowWhen: ("authenticated" | "unauthenticated")[];
};

const Link = (props: ComponentProps<"a">) =>
Expand All @@ -24,6 +25,25 @@ const Link = (props: ComponentProps<"a">) =>
<RouterLink {...(props as InertiaLinkProps)} />
);

const allPages: Page[] = [
{
component: "Integrations/Index",
key: "integrations",
shouldShowWhen: ["authenticated"],
},
{ key: "opportunities", shouldShowWhen: ["unauthenticated"] },
{
key: "prices",
shouldShowWhen: ["unauthenticated"],
},
{ key: "documentation", shouldShowWhen: ["unauthenticated"] },
{
component: "Support/Index",
key: "support",
shouldShowWhen: ["authenticated", "unauthenticated"],
},
] as const;

type Props = ComponentProps<"section"> & {
orientation?: "vertical" | "horizontal";
};
Expand All @@ -39,18 +59,11 @@ export default function Navigation({
const { component } = usePage();
const isAuthenticated = useIsAuthenticated();

const pages: Page[] = [
isAuthenticated && {
component: "Integrations/Index",
key: "integrations",
},
{ key: "opportunities" },
{
key: "prices",
},
{ key: "documentation" },
{ component: "Support/Index", key: "support" },
].filter((it) => !!it);
const pages: Page[] = allPages.filter((it) =>
it.shouldShowWhen.includes(
isAuthenticated ? "authenticated" : "unauthenticated"
)
);

const classes = classNames(
"flex md:items-center md:justify-start gap-36 px-7 max-md:p-4 max-md:gap-5",
Expand Down
25 changes: 11 additions & 14 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,17 @@

Route::post('/newsletter', [NewsletterController::class, 'subscribe']);

Route::group(['middleware' => 'auth'], static function () {
TranslatedRoute::get(
[
'/en/support',
'/nl/ondersteuning',
],
[SupportController::class, 'index'],
'support.index'
);
});

Route::group(['middleware' => 'auth'], static function () {
Route::post('/support/slack', [SupportController::class, 'sendInvitation']);
});
TranslatedRoute::get(
[
'/en/support',
'/nl/ondersteuning',
],
[SupportController::class, 'index'],
'support.index'
);

Route::post('/support/slack', [SupportController::class, 'sendInvitation'])
->middleware('auth');

Route::group(['middleware' => 'auth'], static function () {
TranslatedRoute::get(
Expand Down

0 comments on commit c772d0e

Please sign in to comment.