Skip to content

Commit

Permalink
Merge pull request #14 from route06inc/merge-a-repo
Browse files Browse the repository at this point in the history
Merge private repo
  • Loading branch information
masutaka authored Oct 17, 2024
2 parents 2ce91e4 + 1ca9aae commit 433fe94
Show file tree
Hide file tree
Showing 372 changed files with 22,577 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

.trigger
.turbo

# Sentry Config File
.env.sentry-build-plugin
13 changes: 13 additions & 0 deletions .zed/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"formatter": {
"external": {
"command": "bunx",
"arguments": [
"@biomejs/biome",
"check",
"--apply",
"--stdin-file-path={buffer_path}"
]
}
}
}
38 changes: 38 additions & 0 deletions .zed/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[
{
"label": "biome",
"command": "bunx @biomejs/biome check --write $ZED_WORKTREE_ROOT",
"allow_concurrent_runs": false
},
{
"label": "dev",
"command": "bun dev",
"allow_concurrent_runs": false
},
{
"label": "drizzle studio",
"command": "bunx drizzle-kit studio",
"allow_concurrent_runs": false
},
{
"label": "tsc",
"command": "bun tsc",
"allow_concurrent_runs": false,
"hide": "on_success"
},
{
"label": "npm-check-updates",
"command": "bunx npm-check-updates",
"allow_concurrent_runs": false
},
{
"label": "deploy-trigger-staging",
"command": "./deploy-trigger",
"env": { "ENV": "staging" }
},
{
"label": "deploy-trigger-production",
"command": "./deploy-trigger",
"env": { "ENV": "prod" }
}
]
9 changes: 9 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Third-party Packages

| Name | License | Project |
|---|---|---|
| @img/sharp-libvips-darwin-arm64 | LGPL-3.0-or-later | https://github.com/lovell/sharp-libvips |
| @img/sharp-libvips-linux-x64 | LGPL-3.0-or-later | https://github.com/lovell/sharp-libvips |
| @img/sharp-libvips-linuxmusl-x64 | LGPL-3.0-or-later | https://github.com/lovell/sharp-libvips |
| caniuse-lite | CC-BY-4.0 | https://github.com/browserslist/caniuse-lite |
| mdn-data | CC0 1.0 Universal | https://github.com/mdn/data |
18 changes: 18 additions & 0 deletions app/(auth)/components/action-prompt.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { FC, ReactNode } from "react";

type ActionPromptProps = {
leftIcon?: ReactNode;
prompt?: string;
action: ReactNode;
};
export const ActionPrompt: FC<ActionPromptProps> = ({
prompt,
action,
leftIcon,
}) => (
<div className="text-[14px] text-black-30 font-rosart flex gap-[2px] items-center">
{leftIcon && leftIcon}
{prompt && <p>{prompt}</p>}
{action}
</div>
);
16 changes: 16 additions & 0 deletions app/(auth)/components/divider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { FC } from "react";

type DividerProps = {
label?: string;
};
export const Divider: FC<DividerProps> = ({ label }) => {
return (
<div className="flex items-center">
<div className="flex-grow border-t border-black-70" />
{label && (
<span className="flex-shrink mx-4 text-gray-500 text-sm">{label}</span>
)}
<div className="flex-grow border-t border-black-70" />
</div>
);
};
65 changes: 65 additions & 0 deletions app/(auth)/components/form.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
"use client";

import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import type { AuthError } from "@/lib/supabase";
import { TriangleAlertIcon } from "lucide-react";
import Link from "next/link";
import type { FC } from "react";

type FormProps = {
authError: AuthError | null;
linkToResetPassword?: boolean;
submitText?: string;
isPending: boolean;
};
export const Form: FC<FormProps> = ({
linkToResetPassword = false,
submitText = "Submit",
authError,
isPending,
}) => {
return (
<div className="grid gap-6">
{authError && (
<Alert variant="destructive">
<TriangleAlertIcon className="w-4 h-4" />
<AlertTitle>Authentication Error</AlertTitle>
<AlertDescription>
{authError.message || "An error occurred. Please try again."}
</AlertDescription>
</Alert>
)}
<div className="grid gap-[16px]">
<div className="grid gap-[4px]">
<Label htmlFor="email">Email</Label>
<Input id="email" type="email" name="email" required />
</div>
<div className="grid gap-[4px]">
<div className="flex items-center">
<Label htmlFor="password">Password</Label>
{linkToResetPassword && (
<Link
href="/password_reset"
className="ml-auto text-[12px] text-black-70"
>
Forgot your password?
</Link>
)}
</div>
<Input id="password" type="password" name="password" required />
</div>
<Button
className="w-full"
type="submit"
disabled={isPending}
data-loading={isPending}
>
{submitText}
</Button>
</div>
</div>
);
};
1 change: 1 addition & 0 deletions app/(auth)/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./form";
22 changes: 22 additions & 0 deletions app/(auth)/components/legal-consent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Link from "next/link";
import type { FC } from "react";

export const LegalConsent: FC = () => (
<p className="font-avenir text-[14px] text-black-70">
By continuing, you agree to our{" "}
<Link
href="https://giselles.ai/legal/terms"
className="font-[900] underline"
>
Terms of Service
</Link>{" "}
and{" "}
<Link
href="https://giselles.ai/legal/privacy"
className="font-[900] underline"
>
Privacy Policy
</Link>
.
</p>
);
28 changes: 28 additions & 0 deletions app/(auth)/components/oauth-providers.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Button } from "@/components/ui/button";
import { SiGithub, SiGoogle } from "@icons-pack/react-simple-icons";
import Link from "next/link";
import type { FC } from "react";

export const OAuthProviders: FC = () => (
<div className="space-y-2">
<Button asChild variant="link">
<Link href="/signup/google">
<SiGoogle className="h-[20px] w-[20px]" />
<p>Sign up with Google</p>
</Link>
</Button>
{/**<button
className="w-full flex items-center justify-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-gray-700 hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-cyan-500"
type="button"
>
<Microsoft className="h-5 w-5 mr-2" /> Sign up with Microsoft
</button>**/}

<Button asChild variant="link">
<Link href="/signup/github">
<SiGithub className="h-[20px] w-[20px]" />
<p>Sign up with GitHub</p>
</Link>
</Button>
</div>
);
14 changes: 14 additions & 0 deletions app/(auth)/components/page-header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { FC, ReactNode } from "react";
import { PageTitle } from "./page-title";

type PageHeaderProps = {
title: ReactNode;
description?: ReactNode;
};

export const PageHeader: FC<PageHeaderProps> = ({ title, description }) => (
<div className="grid gap-[28px]">
<PageTitle>{title}</PageTitle>
{description && <p className="text-black-70 text-[14px]">{description}</p>}
</div>
);
7 changes: 7 additions & 0 deletions app/(auth)/components/page-title.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { FC, PropsWithChildren } from "react";

export const PageTitle: FC<PropsWithChildren> = ({ children }) => (
<h2 className="mt-6 text-3xl font-[400] text-black-30 font-rosart text-center">
{children}
</h2>
);
21 changes: 21 additions & 0 deletions app/(auth)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { GiselleLogo } from "@/components/giselle-logo";
import type { ReactNode } from "react";

export default function AuthLayout({ children }: { children: ReactNode }) {
return (
<div className="bg-black-100 relative">
<div className="z-10 relative">{children}</div>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 100 100"
className="absolute inset-0 w-full h-full z-0 blur-[100px] fill-black-80"
>
<title>ambient light</title>
<circle cx="50" cy="50" r="50" />
</svg>
<div className="z-0 absolute inset-0 flex justify-center overflow-hidden">
<GiselleLogo className="w-[110%] h-[110%] absolute -bottom-[20%] fill-black-30 opacity-5" />
</div>
</div>
);
}
28 changes: 28 additions & 0 deletions app/(auth)/lib/get-current-subscription.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"use server";

import {
db,
organizations,
supabaseUserMappings,
teamMemberships,
teams,
} from "@/drizzle";
import { getUser } from "@/lib/supabase";
import { eq } from "drizzle-orm";

export const getUserSubscriptionId = async () => {
const user = await getUser();
const [subscription] = await db
.select({
organizationId: organizations.dbId, // todo: replace with 'subscriptionId' if subscriptions table is created in the future
})
.from(organizations)
.innerJoin(teams, eq(teams.organizationDbId, organizations.dbId))
.innerJoin(teamMemberships, eq(teamMemberships.teamDbId, teams.dbId))
.innerJoin(
supabaseUserMappings,
eq(supabaseUserMappings.userDbId, teamMemberships.userDbId),
)
.where(eq(supabaseUserMappings.supabaseUserId, user.id));
return subscription.organizationId;
};
21 changes: 21 additions & 0 deletions app/(auth)/lib/get-current-team.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"use server";

import { db, supabaseUserMappings, teamMemberships, teams } from "@/drizzle";
import { getUser } from "@/lib/supabase";
import { eq } from "drizzle-orm";

export const getCurrentTeam = async () => {
const user = await getUser();
const [team] = await db
.select({
dbId: teams.dbId,
})
.from(teams)
.innerJoin(teamMemberships, eq(teamMemberships.teamDbId, teams.dbId))
.innerJoin(
supabaseUserMappings,
eq(supabaseUserMappings.userDbId, teamMemberships.userDbId),
)
.where(eq(supabaseUserMappings.supabaseUserId, user.id));
return team;
};
23 changes: 23 additions & 0 deletions app/(auth)/lib/get-initialization-task.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// "use server";

// import { db, supabaseUserMappings, userInitialTasks } from "@/drizzle";
// import { runs } from "@trigger.dev/sdk/v3";
// import { eq } from "drizzle-orm";

// type GetInitializationTaskArgs = {
// supabaseUserId: string;
// };
// export const getUserInitializationTask = async ({
// supabaseUserId,
// }: GetInitializationTaskArgs) => {
// const [task] = await db
// .select({ id: userInitialTasks.taskId })
// .from(supabaseUserMappings)
// .innerJoin(
// userInitialTasks,
// eq(userInitialTasks.userId, supabaseUserMappings.userId),
// )
// .where(eq(supabaseUserMappings.supabaseUserId, supabaseUserId));
// const run = await runs.retrieve(task.id);
// return run;
// };
Loading

0 comments on commit 433fe94

Please sign in to comment.