Skip to content

Commit

Permalink
more file renames
Browse files Browse the repository at this point in the history
  • Loading branch information
berekuk committed Nov 30, 2024
1 parent 0c56131 commit 15d4c11
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 45 deletions.
7 changes: 7 additions & 0 deletions packages/hub/src/app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Next.js app router root.

Conventions:

- store single use components in this folder, next to their `page.tsx` and `layout.tsx`
- if the component is shared between multiple pages, store it in `src/{topic}/components`, where `{topic}` is something like "models" or "relative-values"
- if the component doesn't have an obvious topic, e.g. if it's a generic UI component, store it in `src/components`
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { EditSquiggleSnippetModel } from "@/app/models/[owner]/[slug]/EditSquigg
import { loadModelFullAction } from "@/models/actions/loadModelFullAction";
import { ModelByVersion } from "@/models/data/byVersion";
import { ModelFullDTO } from "@/models/data/full";
import { sqProjectWithHubLinker } from "@/squiggle/components/linker";
import { sqProjectWithHubLinker } from "@/squiggle/linker";

const InnerUpgradeableModel: FC<{
model: ModelFullDTO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import {
getHubLinker,
parseSourceId,
serializeSourceId,
} from "@/squiggle/components/linker";
} from "@/squiggle/linker";

import {
Draft,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "@quri/versioned-squiggle-components";

import { ModelRevisionFullDTO } from "@/models/data/fullRevision";
import { getHubLinker } from "@/squiggle/components/linker";
import { getHubLinker } from "@/squiggle/linker";

export const ModelRevisionView: FC<{
revision: ModelRevisionFullDTO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
versionSupportsSqPathV2,
} from "@quri/versioned-squiggle-components";

import { sqProjectWithHubLinker } from "@/squiggle/components/linker";
import { sqProjectWithHubLinker } from "@/squiggle/linker";
import { VariableRevisionFullDTO } from "@/variables/data/fullVariableRevision";

type SquiggleProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from "@quri/versioned-squiggle-components";

import { ModelCardDTO } from "@/models/data/cards";
import { sqProjectWithHubLinker } from "@/squiggle/components/linker";
import { sqProjectWithHubLinker } from "@/squiggle/linker";

type Props = {
data: NonNullable<ModelCardDTO["currentRevision"]["squiggleSnippet"]>;
Expand Down
38 changes: 0 additions & 38 deletions packages/hub/src/groups/data/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { MembershipRole } from "@prisma/client";

import { auth } from "@/lib/server/auth";
import { prisma } from "@/lib/server/prisma";
import { getSessionUserOrRedirect } from "@/users/auth";

Expand All @@ -11,41 +8,6 @@ export async function hasGroupMembership(groupSlug: string): Promise<boolean> {
return !!(await getMyGroup(groupSlug));
}

export type GroupInviteDTO = {
id: string;
role: MembershipRole;
};

export async function loadInviteForMe(
groupSlug: string
): Promise<GroupInviteDTO | null> {
const session = await auth();
if (!session?.user.email) {
return null;
}

const invite = await prisma.groupInvite.findFirst({
select: {
id: true,
role: true,
},
where: {
group: { asOwner: { slug: groupSlug } },
user: { email: session.user.email },
status: "Pending",
},
});

if (!invite) {
return null;
}

return {
id: invite.id,
role: invite.role,
};
}

export async function validateReusableGroupInviteToken(input: {
groupSlug: string;
inviteToken: string;
Expand Down
7 changes: 7 additions & 0 deletions packages/hub/src/lib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Files that are shared between different parts of the codebase.

`lib/server` is for server-only code.

`lib/hooks` for common React hooks.

Other files are shared.
2 changes: 1 addition & 1 deletion packages/hub/src/lib/server/runSquiggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {

import { SAMPLE_COUNT_DEFAULT, XY_POINT_LENGTH_DEFAULT } from "@/lib/constants";
import { prisma } from "@/lib/server/prisma";
import { parseSourceId } from "@/squiggle/components/linker";
import { parseSourceId } from "@/squiggle/linker";

function getKey(code: string, seed: string): string {
return crypto
Expand Down
2 changes: 1 addition & 1 deletion packages/hub/src/squiggle/components/ImportTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { loadModelCardAction } from "@/models/actions/loadModelCardAction";
import { ModelCard } from "@/models/components/ModelCard";
import { ModelCardDTO } from "@/models/data/cards";

import { parseSourceId } from "./linker";
import { parseSourceId } from "../linker";

type Props = {
importId: string;
Expand Down
File renamed without changes.

0 comments on commit 15d4c11

Please sign in to comment.