Skip to content

Commit

Permalink
Organize reviews by milestone, and give each one a page listing its p…
Browse files Browse the repository at this point in the history
…revious discussions.
  • Loading branch information
jyasskin committed Nov 11, 2024
1 parent ee29b1d commit 9e98514
Show file tree
Hide file tree
Showing 18 changed files with 445 additions and 52 deletions.
5 changes: 5 additions & 0 deletions github-gql/get-recent-design-reviews.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ query RecentDesignReviews(
name
}
}
milestone {
id
title
dueOn
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@
},
"dependencies": {
"@astrojs/node": "^8.3.4",
"@github/relative-time-element": "^4.4.3",
"@graphql-typed-document-node/core": "^3.2.0",
"@js-temporal/polyfill": "^0.4.4",
"@observablehq/plot": "^0.6.16",
"@octokit/webhooks": "^13.3.0",
"@prisma/client": "^5.22.0",
"astro": "^4.16.9",
"mdast-util-from-markdown": "^2.0.2",
"mdast-util-gfm": "^3.0.0",
"mdast-util-to-string": "^4.0.0",
"micromark": "^4.0.0",
"micromark-extension-gfm": "^3.0.0",
"octokit": "^4.0.2",
"prisma": "^5.22.0",
Expand Down
70 changes: 49 additions & 21 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions prisma/migrations/20241111001803_milestones/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-- CreateTable
CREATE TABLE "Milestone" (
"id" TEXT NOT NULL PRIMARY KEY,
"title" TEXT NOT NULL,
"dueOn" DATETIME
);

-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_DesignReview" (
"id" TEXT NOT NULL PRIMARY KEY,
"number" INTEGER NOT NULL,
"title" TEXT NOT NULL,
"body" TEXT NOT NULL,
"milestoneId" TEXT,
"created" DATETIME NOT NULL,
"updated" DATETIME NOT NULL,
"closed" DATETIME,
CONSTRAINT "DesignReview_milestoneId_fkey" FOREIGN KEY ("milestoneId") REFERENCES "Milestone" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
INSERT INTO "new_DesignReview" ("body", "closed", "created", "id", "number", "title", "updated") SELECT "body", "closed", "created", "id", "number", "title", "updated" FROM "DesignReview";
DROP TABLE "DesignReview";
ALTER TABLE "new_DesignReview" RENAME TO "DesignReview";
CREATE UNIQUE INDEX "DesignReview_number_key" ON "DesignReview"("number");
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;
9 changes: 9 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ model DesignReview {
/// The initial comment on the issue, in Markdown format.
body String
labels ReviewLabel[]
milestoneId String?
milestone Milestone? @relation(fields: [milestoneId], references: [id], onDelete: SetNull)
created DateTime
updated DateTime
closed DateTime?
Expand All @@ -35,6 +37,13 @@ model ReviewLabel {
@@unique([reviewId, labelId])
}

model Milestone {
id String @id
title String
dueOn DateTime?
designReviews DesignReview[]
}

/// Either an in-person multi-day meeting or a week of telecons.
model Meeting {
year Int
Expand Down
17 changes: 17 additions & 0 deletions src/components/Markdown.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
import { micromark } from "micromark";
import { gfm, gfmHtml } from "micromark-extension-gfm";
interface Props {
source: string;
}
const { source } = Astro.props;
const html = micromark(source, {
extensions: [gfm()],
htmlExtensions: [gfmHtml()],
});
---

<div set:html={html} />
18 changes: 18 additions & 0 deletions src/components/RelativeTime.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
interface Props {
datetime: Date;
}
const { datetime } = Astro.props;
const defaultFormatter = Intl.DateTimeFormat("en-us", {
timeZone: "UTC",
dateStyle: "medium",
});
---

<script>
import "@github/relative-time-element";
</script>
<relative-time datetime={datetime.toISOString()}
>{defaultFormatter.format(datetime)}</relative-time
>
Loading

0 comments on commit 9e98514

Please sign in to comment.