Skip to content

Commit

Permalink
misc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed May 23, 2024
1 parent 18eeaee commit f32e267
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 36 deletions.
6 changes: 6 additions & 0 deletions site/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Toaster } from "@/components/ui/sonner";
import "./global.css";
import { RootProvider } from "fumadocs-ui/provider";
import type { Metadata } from "next";
import { AxiomWebVitals } from "next-axiom";
import { Inter } from "next/font/google";
import type { ReactNode } from "react";
Expand All @@ -9,6 +10,11 @@ const inter = Inter({
subsets: ["latin"],
});

export const metadata: Metadata = {
title: "Litehouse",
description: "Liteweight house automation system, build on web assembly.",
};

export default function Layout({ children }: { children: ReactNode }) {
return (
<html lang="en" className={inter.className}>
Expand Down
3 changes: 0 additions & 3 deletions site/app/registry/[...slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { type Plugin, PluginPage } from "@/components/plugin-page";
import { getPluginData, getPlugins } from "@/lib/registry";
import type { Metadata } from "next";
import { NextPage } from "next";
import { notFound, useRouter } from "next/navigation";
import { PropsWithChildren } from "react";

const Page = async ({ params }: { params: { slug: string[] } }) => {
const plugin = params.slug[0];
Expand Down
2 changes: 1 addition & 1 deletion site/components/copy-box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function CopyBox({
</div>
<CopyButton
onCopy={() => {
let accept = beforeCopy?.();
const accept = beforeCopy?.();
if (accept === false) return false;
navigator.clipboard.writeText(command);
return true;
Expand Down
4 changes: 2 additions & 2 deletions site/components/plugin-page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { GithubStars as GithubBanner } from "@/components/github-stars";
import { SchemaEditor } from "./shema-editor";
import { SVGProps } from "react";
import Link from "next/link";
import type { SVGProps } from "react";
import { AddButton } from "./add-button";
import { SchemaEditor } from "./shema-editor";
import { Button } from "./ui/button";

export type Plugin = {
Expand Down
4 changes: 3 additions & 1 deletion site/components/registry-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ export function RegistryPage(props: {
{props.pluginCount} out of {props.pluginCount} results
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
{props.packages?.map((p) => <Package key={p.title} {...p} />)}
{props.packages?.map((p) => (
<Package key={p.title} {...p} />
))}
</div>
</div>
);
Expand Down
15 changes: 8 additions & 7 deletions site/components/shema-editor.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"use client";

import Ajv from "ajv";
import { useState } from "react";
import { CopyBox } from "./copy-box";
import z from "zod";
import { useForm } from "react-hook-form";
import Ajv from "ajv";
import { Input } from "./ui/input";
import { toast } from "sonner";
import z from "zod";
import { CopyBox } from "./copy-box";
import { Input } from "./ui/input";

const configSchema = (name: string) =>
z.object({
Expand Down Expand Up @@ -128,14 +128,15 @@ export const SchemaEditor = ({ id, schema: schemaString }) => {
const valid = ajv.validate(schemaData, form.getValues());
if (!valid) {
toast.error("Invalid config", {
description: `Make sure you match the schema correctly: ${ajv.errorsText(ajv.errors)}`,
description: `Make sure you match the schema correctly: ${ajv.errorsText(
ajv.errors,
)}`,
important: true,
});
console.log("ERROR", ajv.errors);
return false;
} else {
return true;
}
return true;
}}
className="text-sm"
command={`litehouse add ${id}${addCommand ? `#${addCommand}` : ""}`}
Expand Down
41 changes: 21 additions & 20 deletions site/components/ui/input-otp.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use client"
"use client";

import * as React from "react"
import { OTPInput, OTPInputContext } from "input-otp"
import { Dot } from "lucide-react"
import { OTPInput, OTPInputContext } from "input-otp";
import { Dot } from "lucide-react";
import * as React from "react";

import { cn } from "@/lib/utils"
import { cn } from "@/lib/utils";

const InputOTP = React.forwardRef<
React.ElementRef<typeof OTPInput>,
Expand All @@ -14,36 +14,37 @@ const InputOTP = React.forwardRef<
ref={ref}
containerClassName={cn(
"flex items-center gap-2 has-[:disabled]:opacity-50",
containerClassName
containerClassName,
)}
className={cn("disabled:cursor-not-allowed", className)}
{...props}
/>
))
InputOTP.displayName = "InputOTP"
));
InputOTP.displayName = "InputOTP";

const InputOTPGroup = React.forwardRef<
React.ElementRef<"div">,
React.ComponentPropsWithoutRef<"div">
>(({ className, ...props }, ref) => (
<div ref={ref} className={cn("flex items-center", className)} {...props} />
))
InputOTPGroup.displayName = "InputOTPGroup"
));
InputOTPGroup.displayName = "InputOTPGroup";

const InputOTPSlot = React.forwardRef<
React.ElementRef<"div">,
React.ComponentPropsWithoutRef<"div"> & { index: number }
>(({ index, className, ...props }, ref) => {
const inputOTPContext = React.useContext(OTPInputContext)
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index]
const inputOTPContext = React.useContext(OTPInputContext);
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];

return (
<div
ref={ref}
className={cn(
"relative flex h-10 w-10 items-center justify-center border-y border-r border-gray-200 text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md dark:border-gray-800",
isActive && "z-10 ring-2 ring-gray-950 ring-offset-white dark:ring-gray-300 dark:ring-offset-gray-950",
className
isActive &&
"z-10 ring-2 ring-gray-950 ring-offset-white dark:ring-gray-300 dark:ring-offset-gray-950",
className,
)}
{...props}
>
Expand All @@ -54,9 +55,9 @@ const InputOTPSlot = React.forwardRef<
</div>
)}
</div>
)
})
InputOTPSlot.displayName = "InputOTPSlot"
);
});
InputOTPSlot.displayName = "InputOTPSlot";

const InputOTPSeparator = React.forwardRef<
React.ElementRef<"div">,
Expand All @@ -65,7 +66,7 @@ const InputOTPSeparator = React.forwardRef<
<div ref={ref} role="separator" {...props}>
<Dot />
</div>
))
InputOTPSeparator.displayName = "InputOTPSeparator"
));
InputOTPSeparator.displayName = "InputOTPSeparator";

export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
2 changes: 1 addition & 1 deletion site/hooks/use-indexed-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const useIndexedDb = <T>(
console.error(e);
};
},
[db, generation, increment, storeName],
[db, increment, storeName],
);

const subscribe = useCallback(
Expand Down
2 changes: 1 addition & 1 deletion site/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createPreset } from "fumadocs-ui/tailwind-plugin";
import animations from "@midudev/tailwind-animations";
import { createPreset } from "fumadocs-ui/tailwind-plugin";

/** @type {import('tailwindcss').Config} */
export default {
Expand Down

0 comments on commit f32e267

Please sign in to comment.