mirror of
https://github.com/hsjobeki/noogle.git
synced 2024-08-18 01:00:33 +03:00
website: add update date for docs
This commit is contained in:
parent
ae6f0d0d4a
commit
00b137fb34
@ -3,6 +3,11 @@
|
|||||||
let
|
let
|
||||||
inherit (inputs'.nix.packages) nix;
|
inherit (inputs'.nix.packages) nix;
|
||||||
nixpkgs = self'.packages.nixpkgs-migrated;
|
nixpkgs = self'.packages.nixpkgs-migrated;
|
||||||
|
|
||||||
|
sourceInfo' = {
|
||||||
|
inherit (inputs.nixpkgs-master.sourceInfo) rev lastModified;
|
||||||
|
};
|
||||||
|
metaFile = builtins.toFile "meta.json" (builtins.toJSON sourceInfo');
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages = {
|
packages = {
|
||||||
@ -10,7 +15,7 @@
|
|||||||
name = "pasta-meta";
|
name = "pasta-meta";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
echo "\"${builtins.toJSON inputs.nixpkgs-master.rev}\"" > $out
|
cat ${metaFile} > $out
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
pasta = pkgs.callPackage ./default.nix { inherit nixpkgs nix pkgs; };
|
pasta = pkgs.callPackage ./default.nix { inherit nixpkgs nix pkgs; };
|
||||||
|
21
website/nix/pdefs.nix
vendored
21
website/nix/pdefs.nix
vendored
@ -4616,6 +4616,19 @@
|
|||||||
version = "1.0.8";
|
version = "1.0.8";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
date-fns = {
|
||||||
|
"3.6.0" = {
|
||||||
|
fetchInfo = {
|
||||||
|
narHash = "sha256-DQyJylOaiikHJ9QTCxdWaCghyTmeembq3pWc9D/gi9E=";
|
||||||
|
type = "tarball";
|
||||||
|
url = "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz";
|
||||||
|
};
|
||||||
|
ident = "date-fns";
|
||||||
|
ltype = "file";
|
||||||
|
treeInfo = { };
|
||||||
|
version = "3.6.0";
|
||||||
|
};
|
||||||
|
};
|
||||||
debug = {
|
debug = {
|
||||||
"3.2.7" = {
|
"3.2.7" = {
|
||||||
depInfo = {
|
depInfo = {
|
||||||
@ -13860,6 +13873,11 @@
|
|||||||
pin = "0.1.0";
|
pin = "0.1.0";
|
||||||
runtime = true;
|
runtime = true;
|
||||||
};
|
};
|
||||||
|
date-fns = {
|
||||||
|
descriptor = "^3.6.0";
|
||||||
|
pin = "3.6.0";
|
||||||
|
runtime = true;
|
||||||
|
};
|
||||||
eslint = {
|
eslint = {
|
||||||
descriptor = "8.50.0";
|
descriptor = "8.50.0";
|
||||||
pin = "8.50.0";
|
pin = "8.50.0";
|
||||||
@ -14907,6 +14925,9 @@
|
|||||||
dev = true;
|
dev = true;
|
||||||
key = "damerau-levenshtein/1.0.8";
|
key = "damerau-levenshtein/1.0.8";
|
||||||
};
|
};
|
||||||
|
"node_modules/date-fns" = {
|
||||||
|
key = "date-fns/3.6.0";
|
||||||
|
};
|
||||||
"node_modules/debug" = {
|
"node_modules/debug" = {
|
||||||
key = "debug/4.3.4";
|
key = "debug/4.3.4";
|
||||||
};
|
};
|
||||||
|
15
website/package-lock.json
generated
15
website/package-lock.json
generated
@ -21,6 +21,7 @@
|
|||||||
"@next/mdx": "^14.0.4",
|
"@next/mdx": "^14.0.4",
|
||||||
"@types/mdx": "^2.0.10",
|
"@types/mdx": "^2.0.10",
|
||||||
"@vcarl/remark-headings": "^0.1.0",
|
"@vcarl/remark-headings": "^0.1.0",
|
||||||
|
"date-fns": "^3.6.0",
|
||||||
"hast": "^1.0.0",
|
"hast": "^1.0.0",
|
||||||
"hast-util-to-string": "^3.0.0",
|
"hast-util-to-string": "^3.0.0",
|
||||||
"highlight.js": "^11.7.0",
|
"highlight.js": "^11.7.0",
|
||||||
@ -3470,6 +3471,15 @@
|
|||||||
"integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==",
|
"integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/date-fns": {
|
||||||
|
"version": "3.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz",
|
||||||
|
"integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==",
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/kossnocorp"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/debug": {
|
"node_modules/debug": {
|
||||||
"version": "4.3.4",
|
"version": "4.3.4",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||||
@ -14777,6 +14787,11 @@
|
|||||||
"integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==",
|
"integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"date-fns": {
|
||||||
|
"version": "3.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz",
|
||||||
|
"integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww=="
|
||||||
|
},
|
||||||
"debug": {
|
"debug": {
|
||||||
"version": "4.3.4",
|
"version": "4.3.4",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
"@next/mdx": "^14.0.4",
|
"@next/mdx": "^14.0.4",
|
||||||
"@types/mdx": "^2.0.10",
|
"@types/mdx": "^2.0.10",
|
||||||
"@vcarl/remark-headings": "^0.1.0",
|
"@vcarl/remark-headings": "^0.1.0",
|
||||||
|
"date-fns": "^3.6.0",
|
||||||
"hast": "^1.0.0",
|
"hast": "^1.0.0",
|
||||||
"hast-util-to-string": "^3.0.0",
|
"hast-util-to-string": "^3.0.0",
|
||||||
"highlight.js": "^11.7.0",
|
"highlight.js": "^11.7.0",
|
||||||
|
@ -11,9 +11,11 @@ import React, { Suspense } from "react";
|
|||||||
import { PositionLink } from "@/components/PositionLink";
|
import { PositionLink } from "@/components/PositionLink";
|
||||||
import { SearchNav } from "@/components/SearchNav";
|
import { SearchNav } from "@/components/SearchNav";
|
||||||
|
|
||||||
|
import upstreamInfo from "@/models/data/meta.json" assert { type: "json" };
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { Metadata, ResolvingMetadata } from "next";
|
import { Metadata, ResolvingMetadata } from "next";
|
||||||
|
import { LastUpdatedFromCommit } from "@/components/LastUpdatedFromCommit";
|
||||||
|
|
||||||
// Important the key ("path") in the returned dict MUST match the dynamic path segment ([...path])
|
// Important the key ("path") in the returned dict MUST match the dynamic path segment ([...path])
|
||||||
export async function generateStaticParams(): Promise<{ path: string[] }[]> {
|
export async function generateStaticParams(): Promise<{ path: string[] }[]> {
|
||||||
@ -230,6 +232,7 @@ export default async function Page(props: { params: { path: string[] } }) {
|
|||||||
>
|
>
|
||||||
{item?.meta.title}
|
{item?.meta.title}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
{meta?.is_primop && meta.count_applied == 0 && (
|
{meta?.is_primop && meta.count_applied == 0 && (
|
||||||
<>
|
<>
|
||||||
<Chip
|
<Chip
|
||||||
@ -255,6 +258,9 @@ export default async function Page(props: { params: { path: string[] } }) {
|
|||||||
)}
|
)}
|
||||||
<ShareButton />
|
<ShareButton />
|
||||||
</Box>
|
</Box>
|
||||||
|
<Box sx={{ pl: 4, m: 1 }} data-pagefind-ignore="all">
|
||||||
|
<LastUpdatedFromCommit {...upstreamInfo} />
|
||||||
|
</Box>
|
||||||
<Divider flexItem sx={{ mt: 2 }} />
|
<Divider flexItem sx={{ mt: 2 }} />
|
||||||
|
|
||||||
<Box sx={{ display: "block" }}>
|
<Box sx={{ display: "block" }}>
|
||||||
|
@ -8,6 +8,7 @@ import {
|
|||||||
import { darkThemeOptions, lightThemeOptions } from "@/styles/theme";
|
import { darkThemeOptions, lightThemeOptions } from "@/styles/theme";
|
||||||
import { ReactNode } from "react";
|
import { ReactNode } from "react";
|
||||||
import { Toaster } from "react-hot-toast";
|
import { Toaster } from "react-hot-toast";
|
||||||
|
|
||||||
const darkTheme = createTheme(darkThemeOptions);
|
const darkTheme = createTheme(darkThemeOptions);
|
||||||
const lightTheme = createTheme(lightThemeOptions);
|
const lightTheme = createTheme(lightThemeOptions);
|
||||||
|
|
||||||
|
45
website/src/components/LastUpdatedFromCommit.tsx
Normal file
45
website/src/components/LastUpdatedFromCommit.tsx
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useMemo } from "react";
|
||||||
|
import { fromUnixTime, formatDistanceToNow, formatISO } from "date-fns";
|
||||||
|
import { Chip, Link, Tooltip } from "@mui/material";
|
||||||
|
|
||||||
|
export const LastUpdatedFromCommit = ({
|
||||||
|
lastModified,
|
||||||
|
rev,
|
||||||
|
}: {
|
||||||
|
lastModified: number;
|
||||||
|
rev: string;
|
||||||
|
}) => {
|
||||||
|
const date = useMemo(() => {
|
||||||
|
const date = fromUnixTime(lastModified);
|
||||||
|
return {
|
||||||
|
repr: formatISO(date, { representation: "date" }),
|
||||||
|
distance: formatDistanceToNow(date),
|
||||||
|
};
|
||||||
|
}, [lastModified]);
|
||||||
|
return (
|
||||||
|
<Tooltip title={`Upstream commit date: ${date.repr}`}>
|
||||||
|
<Chip
|
||||||
|
component="div"
|
||||||
|
label={
|
||||||
|
<span>
|
||||||
|
{"Docs pulled from | "}
|
||||||
|
<Link
|
||||||
|
href={`https://github.com/NixOS/nixpkgs/tree/${rev}`}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
color="inherit"
|
||||||
|
>
|
||||||
|
This Revision
|
||||||
|
</Link>
|
||||||
|
{" | " + date.distance + " ago"}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
variant="outlined"
|
||||||
|
color="primary"
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user