feat(repository): display last commit summary in RepositoryBrowserView (file viewer)@@ -1,5 +1,5 @@
{
- "_generatedAtUnix": 1664235423316,
+ "_generatedAtUnix": 1664235996567,
"_hashAlgorithm": "sha1",
"_version": 2,
"islands": {
@@ -22,7 +22,7 @@
"pathSourceMap": "./public/.islands/RepositoriesList.bundle.js.map"
},
"RepositoryCommitSummaryLine": {
- "hash": "22655539b5b3f2bb9baef061b4c528e0c5395dea",
+ "hash": "be9c9a407d7b3c9a218dc51d76bd65166e477dad",
"pathSource": "./app/islands/RepositoryCommitSummaryLine.tsx",
"pathBundle": "./public/.islands/RepositoryCommitSummaryLine.bundle.js",
"pathSourceMap": "./public/.islands/RepositoryCommitSummaryLine.bundle.js.map"
@@ -74,11 +74,11 @@
"pathSource": "./app/views/organization/OrganizationDetailsView.tsx"
},
"RepositoryBrowserView": {
- "hash": "ed9c8cdbb31ff9004fb8db593b955a96319a00bf",
+ "hash": "04fa7af689f4d2cafd80991ae6d6c0e5252f42a7",
"pathSource": "./app/views/repository/RepositoryBrowserView.tsx"
},
"RepositoryCommitsLogView": {
- "hash": "f1dfffa5192076e35f92416bf4c1b02e3f1fed9b",
+ "hash": "22af9987a48851efcbeed977d79624d9e917233c",
"pathSource": "./app/views/repository/RepositoryCommitsLogView.tsx"
},
"RepositoryCompareView": {
@@ -90,7 +90,7 @@
"pathSource": "./app/views/repository/RepositoryCreateView.tsx"
},
"RepositoryDetailsView": {
- "hash": "cab2ce04422f164590d9e95080fedc4ae65e500f",
+ "hash": "34fe3a6129223bed26c7a249c14909b05617b80a",
"pathSource": "./app/views/repository/RepositoryDetailsView.tsx"
},
"RepositoryExploreView": {
@@ -50,6 +50,15 @@ const getRepositoryBrowserView: ReqHandler = async (request, reply) => {
}
}
+ const commitLogs = await repoService.getRepositoryCommitLog(
+ repo,
+ path,
+ ref,
+ true
+ );
+
+ const lastCommit = commitLogs.length >= 1 ? commitLogs[0] : null;
+
const reqHandler = reply.makeRequestHandler(request, reply);
if (path === "" || path.endsWith("/")) {
@@ -69,15 +78,6 @@ const getRepositoryBrowserView: ReqHandler = async (request, reply) => {
)
: null;
- const commitLogs = await repoService.getRepositoryCommitLog(
- repo,
- path,
- ref,
- true
- );
-
- const lastCommit = commitLogs.length >= 1 ? commitLogs[0] : null;
-
const branches = await repoService.getRepositoryBranches(repo);
const tags = await repoService.getRepositoryTags(repo);
@@ -122,6 +122,7 @@ const getRepositoryBrowserView: ReqHandler = async (request, reply) => {
currentRef: ref,
currentUser,
fileContent,
+ lastCommit,
linguistInfos,
parentOrg,
path,
@@ -46,33 +46,41 @@ const RepositoryCommitSummaryLine: ReactIsland<RepositoryCommitSummaryLineProps>
);
return (
- <Grid.Row gap={8} alignItems={"flex-start"}>
- <Grid.Col fluid>
- <strong>{commit.author.name}</strong>
- <span style={{ flex: 1 }}>
- <a href={`/${orgSlug}/${repoSlug}/show/${commit.commit}`}>
- {subject}
- </a>
- {isSubjectTooLongForDisplay ? (
- <span onClick={toggleFullSubjectVisibility}>{TRAILING_CHAR}</span>
- ) : null}
- </span>
- {isFullSubjectShown ? <code>{commit.subject}</code> : null}
- </Grid.Col>
- <Grid.Col flex={"0 0 205px"} alignItems={"flex-end"}>
- <span>
- <a href={`/${orgSlug}/${repoSlug}/show/${commit.commit}`}>
- {commit.abbreviated_commit}
- </a>
- {commit.abbreviated_parent.trim() != "" ? (
- <a href={`/${orgSlug}/${repoSlug}/show/${commit.parent}`}>
- {` (parent ${commit.abbreviated_parent})`}
+ <Grid.Col fluid nowrap>
+ <Grid.Row gap={8} alignItems={"flex-start"}>
+ <Grid.Col fluid>
+ <strong>{commit.author.name}</strong>
+ <span style={{ marginTop: 8 }}>
+ <a href={`/${orgSlug}/${repoSlug}/show/${commit.commit}`}>
+ {subject}
</a>
- ) : null}
- </span>
- <span>{new Date(commit.author.date).toLocaleString()}</span>
- </Grid.Col>
- </Grid.Row>
+ {isSubjectTooLongForDisplay ? (
+ <span onClick={toggleFullSubjectVisibility}>
+ {TRAILING_CHAR}
+ </span>
+ ) : null}
+ </span>
+ </Grid.Col>
+ <Grid.Col flex={"0 0 205px"} alignItems={"flex-end"}>
+ <span>
+ <a href={`/${orgSlug}/${repoSlug}/show/${commit.commit}`}>
+ {commit.abbreviated_commit}
+ </a>
+ {commit.abbreviated_parent.trim() != "" ? (
+ <a href={`/${orgSlug}/${repoSlug}/show/${commit.parent}`}>
+ {` (parent ${commit.abbreviated_parent})`}
+ </a>
+ ) : null}
+ </span>
+ <span style={{ marginTop: 8 }}>
+ {new Date(commit.author.date).toLocaleString()}
+ </span>
+ </Grid.Col>
+ </Grid.Row>
+ {isFullSubjectShown ? (
+ <code style={{ marginTop: 8 }}>{commit.subject}</code>
+ ) : null}
+ </Grid.Col>
);
};
@@ -7,15 +7,21 @@ import type { Organization, Repository, User } from "@prisma/client";
// app service
import type { LinguistFileInfos } from "../../services/codeAnalysis/types";
// app
-import type { CommonProps, RepositoryFileContent } from "../../types";
+import type {
+ CommonProps,
+ RepositoryFileContent,
+ RepositoryLog,
+} from "../../types";
import { Grid, Layout, PageWrapper, Card } from "../../components";
// app islands
import Code, { getThemedCodeCss } from "../../islands/Code";
+import RepositoryCommitSummaryLine from "../../islands/RepositoryCommitSummaryLine";
export interface RepositoryBrowserViewProps extends CommonProps {
currentRef: string;
currentUser: null | User;
fileContent: RepositoryFileContent;
+ lastCommit: null | RepositoryLog;
linguistInfos: LinguistFileInfos;
parentOrg: Organization;
path: string;
@@ -25,6 +31,7 @@ export interface RepositoryBrowserViewProps extends CommonProps {
const RepositoryBrowserView: ReactView<RepositoryBrowserViewProps> = ({
commonProps,
fileContent,
+ lastCommit,
linguistInfos,
parentOrg,
path,
@@ -45,7 +52,23 @@ const RepositoryBrowserView: ReactView<RepositoryBrowserViewProps> = ({
{path}
</h1>
<Grid.Col fluid style={{ marginTop: 16 }}>
- <Card style={{ width: "100%" }} themeScheme={commonProps.themeScheme}>
+ {lastCommit && (
+ <Card
+ data-islandid={`${RepositoryCommitSummaryLine.name}$$0`}
+ style={{ width: "100%", padding: 8 }}
+ themeScheme={commonProps.themeScheme}
+ >
+ <RepositoryCommitSummaryLine
+ orgSlug={parentOrg.slug}
+ repoSlug={repo.slug}
+ commit={lastCommit}
+ />
+ </Card>
+ )}
+ <Card
+ style={{ width: "100%", marginTop: lastCommit != null ? 16 : 0 }}
+ themeScheme={commonProps.themeScheme}
+ >
<Grid.Row nowrap alignItems={"center"} style={{ width: "100%" }}>
<div>
<strong>lang:</strong> <span>{linguistInfos.language}</span>
@@ -35,25 +35,20 @@ const RepositoryCommitsLogView: ReactView<RepositoryCommitsLogViewProps> = ({
</a>
{" / Commits"}
</h1>
- <Card
- style={{ width: "100%", marginTop: 32 }}
- themeScheme={commonProps.themeScheme}
- >
- {history.map((commit, idx) => (
- <Card
- key={commit.commit}
- data-islandid={`${RepositoryCommitSummaryLine.name}$$${idx}`}
- style={{ width: "100%" }}
- themeScheme={commonProps.themeScheme}
- >
- <RepositoryCommitSummaryLine
- orgSlug={parentOrg.slug}
- repoSlug={repo.slug}
- commit={commit}
- />
- </Card>
- ))}
- </Card>
+ {history.map((commit, idx) => (
+ <Card
+ key={commit.commit}
+ data-islandid={`${RepositoryCommitSummaryLine.name}$$${idx}`}
+ style={{ width: "100%", marginTop: idx >= 1 ? 4 : 32, padding: 8 }}
+ themeScheme={commonProps.themeScheme}
+ >
+ <RepositoryCommitSummaryLine
+ orgSlug={parentOrg.slug}
+ repoSlug={repo.slug}
+ commit={commit}
+ />
+ </Card>
+ ))}
</PageWrapper>
</Layout>
);
@@ -96,7 +96,7 @@ const RepositoryDetailsView: ReactView<RepositoryDetailsViewProps> = ({
<Grid.Col fluid style={{ height: "unset !important" }}>
<Card
data-islandid={`${RepositoryCommitSummaryLine.name}$$0`}
- style={{ width: "100%" }}
+ style={{ width: "100%", padding: 8 }}
themeScheme={commonProps.themeScheme}
>
<RepositoryCommitSummaryLine