Skip to content

Commit

Permalink
Merge branch 'main' of github.com:agicommies/commune-ts
Browse files Browse the repository at this point in the history
  • Loading branch information
PsicoThePato committed Oct 17, 2024
2 parents 50e9d2b + ef16ca4 commit 792b4bf
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 30 deletions.
44 changes: 24 additions & 20 deletions apps/commune-validator/src/app/(pages)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,43 +1,47 @@
import type { Metadata } from "next";
import Link from "next/link";
"use client";

import Link from "next/link";
import { Button, Container, Separator } from "@commune-ts/ui";
import { usePathname } from "next/navigation";

export const metadata: Metadata = {
robots: "all",
title: "Commune AI",
icons: [{ rel: "icon", url: "favicon.ico" }],
description: "Making decentralized AI for everyone",
};
export default function RootLayout({ children }: { children: React.ReactNode }): JSX.Element {
const pathname = usePathname();

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}): JSX.Element {
return (
<div className="pt-4">
<Container>
<div className="mb-4 flex w-full gap-3 border-b border-white/20 text-center">
<div className="flex w-full animate-fade-down flex-col gap-4 pb-4 animate-delay-300 md:flex-row">
<Button size="xl" className="w-full" asChild>
<Button
size="xl"
className={`w-full ${pathname === "/modules" && "border-green-500 bg-background-green text-green-500"}`}
asChild
>
<Link href="/modules">Modules</Link>
</Button>
<Button size="xl" className="w-full" asChild>
<Button
size="xl"
className={`w-full ${pathname === "/weighted-modules" && "border-green-500 bg-background-green text-green-500"}`}
asChild
>
<Link href="/weighted-modules">Your Selected Modules</Link>
</Button>
<Separator orientation="vertical" />
<Button
asChild
size="xl"
className="w-full hover:border-cyan-500 hover:bg-background-cyan hover:text-cyan-500 active:bg-cyan-500/30"
className={`w-full hover:border-cyan-500 hover:bg-background-cyan hover:text-cyan-500 active:bg-cyan-500/30 ${
pathname === "/subnets" && "border-cyan-500 bg-background-cyan text-cyan-500"
}`}
asChild
>
<Link href="/subnets">Subnets</Link>
</Button>
<Button
asChild
size="xl"
className="w-full hover:border-cyan-500 hover:bg-background-cyan hover:text-cyan-500 active:bg-cyan-500/30"
className={`w-full hover:border-cyan-500 hover:bg-background-cyan hover:text-cyan-500 active:bg-cyan-500/30 ${
pathname === "/weighted-subnets" && "border-cyan-500 bg-background-cyan text-cyan-500"
}`}
asChild
>
<Link href="/weighted-subnets">Your Selected Subnets</Link>
</Button>
Expand All @@ -47,4 +51,4 @@ export default function RootLayout({
</Container>
</div>
);
}
}
20 changes: 11 additions & 9 deletions apps/commune-worker/src/common/env.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import type { z } from "zod";

export const parseEnvOrExit = <O>(envSchema: z.ZodType<O>) => (env: unknown) => {
const result = envSchema.safeParse(env);
export const parseEnvOrExit =
<O>(envSchema: z.ZodType<O>) =>
(env: unknown) => {
const result = envSchema.safeParse(env);

if (!result.success) {
console.error("❌ Invalid environment variables:");
console.error(JSON.stringify(result.error.format(), null, 2));
process.exit(1);
}
if (!result.success) {
console.error("❌ Invalid environment variables:");
console.error(JSON.stringify(result.error.format(), null, 2));
process.exit(1);
}

return result.data;
}
return result.data;
};
2 changes: 1 addition & 1 deletion apps/commune-worker/src/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface WebhookPayload {

export async function sendDiscordWebhook(
webhookUrl: string,
payload: WebhookPayload
payload: WebhookPayload,
): Promise<void> {
return await axios.post(webhookUrl, payload, {
headers: { "Content-Type": "application/json" },
Expand Down

0 comments on commit 792b4bf

Please sign in to comment.