GitFOSS
fix(repository): properly type repo and pass needed props in RepoHero
+ 60
- 32
@@ -1,5 +1,5 @@
 {
-  "_generatedAtUnix": 1665028457692,
+  "_generatedAtUnix": 1665168785986,
   "_hashAlgorithm": "sha1",
   "_version": 2,
   "islands": {

...
@@ -92,15 +92,15 @@
       "pathSource": "./app/views/organization/OrganizationDetailsView.tsx"
     },
     "RepositoryBrowserView": {
-      "hash": "995311aeb46709456b948690bd1a8d57aa39fa30",
+      "hash": "be8c3fe71b7ca4ea390a70f54d26488d7516e37d",
       "pathSource": "./app/views/repository/RepositoryBrowserView.tsx"
     },
     "RepositoryCommitsLogView": {
-      "hash": "ee94df9b3d51904e124e61efbc8ef68b2ed51318",
+      "hash": "4995f2eb82a50944bdf952d74e80d9c751f2babe",
       "pathSource": "./app/views/repository/RepositoryCommitsLogView.tsx"
     },
     "RepositoryCompareView": {
-      "hash": "e000be86a120274c507cca7f7ad5de7e53e6d471",
+      "hash": "1dba03624f8d35215715098e4b6c371a5ad63e88",
       "pathSource": "./app/views/repository/RepositoryCompareView.tsx"
     },
     "RepositoryCreateView": {

...
@@ -108,7 +108,7 @@
       "pathSource": "./app/views/repository/RepositoryCreateView.tsx"
     },
     "RepositoryDetailsView": {
-      "hash": "06e76c790f8b3c62a7659dc14a9b1501c5c68327",
+      "hash": "281b2477d757abc076a20ab7c4c4b52be2d47181",
       "pathSource": "./app/views/repository/RepositoryDetailsView.tsx"
     },
     "RepositoryExploreView": {

...
@@ -116,19 +116,19 @@
       "pathSource": "./app/views/repository/RepositoryExploreView.tsx"
     },
     "RepositoryForkView": {
-      "hash": "9c254e18e9a1f3f502e4ac71639bc80caff178e5",
+      "hash": "1a9509ad1a1a6f287f5ca7fd69ccbe5344d9f520",
       "pathSource": "./app/views/repository/RepositoryForkView.tsx"
     },
     "RepositoryPullRequestCreateView": {
-      "hash": "6ebba879724136e446776d131ab071232b838774",
+      "hash": "558b11388971dfa905738fac13c30076576f48c2",
       "pathSource": "./app/views/repository/RepositoryPullRequestCreateView.tsx"
     },
     "RepositoryPullRequestsView": {
-      "hash": "c5683b936b94a3ece6412ae3cec1dabedddd3952",
+      "hash": "2157117fc2fd4ed85694a4a9e420077d8ec10330",
       "pathSource": "./app/views/repository/RepositoryPullRequestsView.tsx"
     },
     "RepositoryShowObjectView": {
-      "hash": "3da754e29eb3a85e1811d2e35aca1c9509ea9d54",
+      "hash": "ba960136b69ddbb078f807b14652d26cbd1cc985",
       "pathSource": "./app/views/repository/RepositoryShowObjectView.tsx"
     },
     "UserDashboardView": {

app/views/repository/RepositoryBrowserView.tsx
@@ -3,13 +3,14 @@ import type { ReactView } from "@ethicdevs/react-monolith";
 // 3rd-party
 import React from "react";
 // generated via script[prisma:generate]
-import type { Organization, Repository, User } from "@prisma/client";
+import type { Organization, User } from "@prisma/client";
 // app
 import type {
   CommonProps,
   LinguistFileInfos,
   RepositoryFileContent,
   RepositoryLog,
+  RepositoryWithForkedFromRepo,
 } from "../../types";
 import {
   Grid,

...
@@ -31,7 +32,7 @@ export interface RepositoryBrowserViewProps extends CommonProps {
   linguistInfos: LinguistFileInfos;
   parentOrg: Organization;
   path: string;
-  repo: Repository;
+  repo: RepositoryWithForkedFromRepo;
 }
 
 const RepositoryBrowserView: ReactView<RepositoryBrowserViewProps> = ({

...
@@ -49,6 +50,8 @@ const RepositoryBrowserView: ReactView<RepositoryBrowserViewProps> = ({
       <PageWrapper>
         <IslandWrapper data-islandid={`${RepositoryHero.name}$$0`}>
           <RepositoryHero
+            forkedFromRepo={repo.forkedFromRepo}
+            forksCount={repo.forks.length}
             parentOrg={parentOrg}
             path={path}
             repo={repo}

app/views/repository/RepositoryCommitsLogView.tsx
@@ -3,9 +3,13 @@ import type { ReactView } from "@ethicdevs/react-monolith";
 // 3rd-party
 import React from "react";
 // generated via script[generate:prisma]
-import type { Organization, Repository } from "@prisma/client";
+import type { Organization } from "@prisma/client";
 // app
-import type { CommonProps, RepositoryLog } from "../../types";
+import type {
+  CommonProps,
+  RepositoryLog,
+  RepositoryWithForkedFromRepo,
+} from "../../types";
 import {
   Card,
   Grid,

...
@@ -21,7 +25,7 @@ export interface RepositoryCommitsLogViewProps extends CommonProps {
   currentRef: string;
   history: RepositoryLog[];
   parentOrg: Organization;
-  repo: Repository;
+  repo: RepositoryWithForkedFromRepo;
 }
 
 const RepositoryCommitsLogView: ReactView<RepositoryCommitsLogViewProps> = ({

...
@@ -35,7 +39,13 @@ const RepositoryCommitsLogView: ReactView<RepositoryCommitsLogViewProps> = ({
     <Layout {...commonProps}>
       <PageWrapper>
         <IslandWrapper data-islandid={`${RepositoryHero.name}$$0`}>
-          <RepositoryHero parentOrg={parentOrg} path={"Commits"} repo={repo} />
+          <RepositoryHero
+            forkedFromRepo={repo.forkedFromRepo}
+            forksCount={repo.forks.length}
+            parentOrg={parentOrg}
+            path={"Commits"}
+            repo={repo}
+          />
         </IslandWrapper>
         <Grid.Col style={{ width: "100%", marginTop: 0 }}>
           {history.map((commit, idx) => (

app/views/repository/RepositoryCompareView.tsx
@@ -3,9 +3,13 @@ import type { ReactView } from "@ethicdevs/react-monolith";
 // 3rd-party
 import React from "react";
 // generated via script[prisma:generate]
-import type { Organization, Repository, User } from "@prisma/client";
+import type { Organization, User } from "@prisma/client";
 // app
-import type { CommonProps, RepositoryFileDiff } from "../../types";
+import type {
+  CommonProps,
+  RepositoryFileDiff,
+  RepositoryWithForkedFromRepo,
+} from "../../types";
 import { Grid, IslandWrapper, Layout, PageWrapper } from "../../components";
 // app islands
 import RepositoryFilesDiffsList from "../../islands/RepositoryFilesDiffsList";

...
@@ -15,7 +19,7 @@ export interface RepositoryCompareViewProps extends CommonProps {
   currentUser: null | User;
   filesDiffs: RepositoryFileDiff[];
   parentOrg: Organization;
-  repo: Repository;
+  repo: RepositoryWithForkedFromRepo;
   refA: string;
   refB: string;
 }

...
@@ -33,6 +37,8 @@ const RepositoryCompareView: ReactView<RepositoryCompareViewProps> = ({
       <PageWrapper>
         <IslandWrapper data-islandid={`${RepositoryHero.name}$$0`}>
           <RepositoryHero
+            forkedFromRepo={repo.forkedFromRepo}
+            forksCount={repo.forks.length}
             parentOrg={parentOrg}
             path={`${refA}..${refB}`}
             repo={repo}

app/views/repository/RepositoryDetailsView.tsx
@@ -66,10 +66,10 @@ const RepositoryDetailsView: ReactView<RepositoryDetailsViewProps> = ({
       <PageWrapper>
         <IslandWrapper data-islandid={`${RepositoryHero.name}$$0`}>
           <RepositoryHero
-            parentOrg={parentOrg}
-            repo={repo}
             forkedFromRepo={forkedFromRepo}
             forksCount={repo.forks.length}
+            parentOrg={parentOrg}
+            repo={repo}
           />
         </IslandWrapper>
         <style

app/views/repository/RepositoryForkView.tsx
@@ -3,9 +3,9 @@ import type { ReactView } from "@ethicdevs/react-monolith";
 // 3rd-party
 import React from "react";
 // generated via script[generate:prisma]
-import { Organization, Repository, ResourceVisibility } from "@prisma/client";
+import { Organization, ResourceVisibility } from "@prisma/client";
 // app
-import type { CommonProps } from "../../types";
+import type { CommonProps, RepositoryWithForkedFromRepo } from "../../types";
 import { IslandWrapper, Layout, PageWrapper } from "../../components";
 // app islands
 import RepositoryForkForm from "../../islands/RepositoryForkForm";

...
@@ -14,7 +14,7 @@ import RepositoryHero from "../../islands/RepositoryHero";
 export interface RepositoryForkViewProps extends CommonProps {
   availableParentOrgs: Organization[];
   sourceParentOrg: Organization;
-  sourceRepo: Repository;
+  sourceRepo: RepositoryWithForkedFromRepo;
   errorMessage?: null | string;
   initialValues?: {
     target_org_slug: string;

...
@@ -37,8 +37,10 @@ const RepositoryForkView: ReactView<RepositoryForkViewProps> = ({
       <PageWrapper>
         <IslandWrapper data-islandid={`${RepositoryHero.name}$$0`}>
           <RepositoryHero
-            parentOrg={sourceParentOrg}
+            forkedFromRepo={sourceRepo.forkedFromRepo}
+            forksCount={sourceRepo.forks.length}
             path={`Fork`}
+            parentOrg={sourceParentOrg}
             repo={sourceRepo}
           />
         </IslandWrapper>

app/views/repository/RepositoryPullRequestCreateView.tsx
@@ -3,9 +3,9 @@ import type { ReactView } from "@ethicdevs/react-monolith";
 // 3rd-party
 import React from "react";
 // generated via script[generate:prisma]
-import type { Organization, PullRequest, Repository } from "@prisma/client";
+import type { Organization, PullRequest } from "@prisma/client";
 // app
-import type { CommonProps } from "../../types";
+import type { CommonProps, RepositoryWithForkedFromRepo } from "../../types";
 import { IslandWrapper, Layout, PageWrapper } from "../../components";
 // app islands
 import RepositoryHero from "../../islands/RepositoryHero";

...
@@ -17,7 +17,7 @@ export interface RepositoryPullRequestCreateViewProps extends CommonProps {
   errorMessage?: string | null;
   initialValues?: PullRequest;
   parentOrg: Organization;
-  repo: Repository;
+  repo: RepositoryWithForkedFromRepo;
   variant: RepositoryPullRequestCreateFormVariant;
 }
 

...
@@ -28,6 +28,8 @@ const RepositoryPullRequestCreateView: ReactView<RepositoryPullRequestCreateView
         <PageWrapper>
           <IslandWrapper data-islandid={`${RepositoryHero.name}$$0`}>
             <RepositoryHero
+              forkedFromRepo={repo.forkedFromRepo}
+              forksCount={repo.forks.length}
               parentOrg={parentOrg}
               path={`Pull Requests / New`}
               repo={repo}

app/views/repository/RepositoryPullRequestsView.tsx
@@ -3,9 +3,9 @@ import type { ReactView } from "@ethicdevs/react-monolith";
 // 3rd-party
 import React from "react";
 // generated via script[generate:prisma]
-import type { Organization, PullRequest, Repository } from "@prisma/client";
+import type { Organization, PullRequest } from "@prisma/client";
 // app
-import type { CommonProps } from "../../types";
+import type { CommonProps, RepositoryWithForkedFromRepo } from "../../types";
 import { Grid, IslandWrapper, Layout, PageWrapper } from "../../components";
 // app islands
 import RepositoryHero from "../../islands/RepositoryHero";

...
@@ -13,7 +13,7 @@ import RepositoryHero from "../../islands/RepositoryHero";
 export interface RepositoryPullRequestsViewProps extends CommonProps {
   parentOrg: Organization;
   pullRequests: PullRequest[];
-  repo: Repository;
+  repo: RepositoryWithForkedFromRepo;
 }
 
 const RepositoryPullRequestsView: ReactView<RepositoryPullRequestsViewProps> =

...
@@ -23,6 +23,8 @@ const RepositoryPullRequestsView: ReactView<RepositoryPullRequestsViewProps> =
         <PageWrapper>
           <IslandWrapper data-islandid={`${RepositoryHero.name}$$0`}>
             <RepositoryHero
+              forkedFromRepo={repo.forkedFromRepo}
+              forksCount={repo.forks.length}
               parentOrg={parentOrg}
               path={`Pull Requests`}
               repo={repo}

app/views/repository/RepositoryShowObjectView.tsx
@@ -3,12 +3,13 @@ import type { ReactView } from "@ethicdevs/react-monolith";
 // 3rd-party
 import React from "react";
 // generated via script[generate:prisma]
-import type { Organization, Repository } from "@prisma/client";
+import type { Organization } from "@prisma/client";
 // app
 import type {
   CommonProps,
   RepositoryFileDiff,
   RepositoryObject,
+  RepositoryWithForkedFromRepo,
 } from "../../types";
 import { Card, IslandWrapper, Layout, PageWrapper } from "../../components";
 // app islands

...
@@ -22,7 +23,7 @@ export interface RepositoryShowObjectViewProps extends CommonProps {
   gitObject: RepositoryObject;
   gitObjectDiffs: RepositoryFileDiff[] | null;
   parentOrg: Organization;
-  repo: Repository;
+  repo: RepositoryWithForkedFromRepo;
 }
 
 const RepositoryShowObjectView: ReactView<RepositoryShowObjectViewProps> = ({

...
@@ -38,6 +39,8 @@ const RepositoryShowObjectView: ReactView<RepositoryShowObjectViewProps> = ({
       <PageWrapper>
         <IslandWrapper data-islandid={`${RepositoryHero.name}$$0`}>
           <RepositoryHero
+            forkedFromRepo={repo.forkedFromRepo}
+            forksCount={repo.forks.length}
             parentOrg={parentOrg}
             path={gitObject.abbreviated_commit}
             repo={repo}