@ethicdevs/gitfoss | Show object: 1583fa79dadd28cc5a58cab58b76c27c78f8a1ac ∙ GitFOSS
fix(pages): add missing titles
+ 64
- 44
app/components/Layout.tsx
@@ -66,6 +66,8 @@ const LayoutComponent: FC<LayoutProps & WithThemeSchemeProp> = (props) => {
             }
             * {
               box-sizing: border-box;
+              -webkit-tap-highlight-color: transparent;
+              -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
             }
             a {
               color: ${NamedColors.TEXT_LINK[themeScheme]};

app/controllers/auth/getLoginView.ts
@@ -6,7 +6,7 @@ import LoginView, { LoginViewProps } from "../../views/auth/LoginView";
 
 const getLoginView: ReqHandler<AppRouteParams, AppRoute.AUTH_LOGIN> = (
   request,
-  reply
+  reply,
 ) => {
   const { after_login_goto } = request.query;
 

...
@@ -20,7 +20,9 @@ const getLoginView: ReqHandler<AppRouteParams, AppRoute.AUTH_LOGIN> = (
   }
 
   const reqHandler = reply.makeRequestHandler(request, reply);
-  return reqHandler<LoginViewProps>(LoginView.name, {});
+  return reqHandler<LoginViewProps>(LoginView.name, {
+    title: "Login",
+  });
 };
 
 export default getLoginView;

app/controllers/auth/getRegisterView.ts
@@ -5,7 +5,9 @@ import RegisterView, { RegisterViewProps } from "../../views/auth/RegisterView";
 
 const getRegisterView: ReqHandler = (request, reply) => {
   const reqHandler = reply.makeRequestHandler(request, reply);
-  return reqHandler<RegisterViewProps>(RegisterView.name, {});
+  return reqHandler<RegisterViewProps>(RegisterView.name, {
+    title: "Register",
+  });
 };
 
 export default getRegisterView;

app/controllers/organization/getOrganizationDetailsView.ts
@@ -51,7 +51,7 @@ const getOrganizationDetailsView: ReqHandler<
   const currentUserMembership =
     curr_user_uid != null
       ? organization.memberships.find(
-          (member) => member.userId === curr_user_uid
+          (member) => member.userId === curr_user_uid,
         ) || null
       : null;
 

...
@@ -59,17 +59,17 @@ const getOrganizationDetailsView: ReqHandler<
     currentUserIsOwner ||
     (currentUserMembership != null && currentUserMembership.revokedAt == null)
   ) {
-    organization.repositories = await orgService.getOrganizationRepositories(
-      organization
-    );
+    organization.repositories =
+      await orgService.getOrganizationRepositories(organization);
   }
 
   const reqHandler = reply.makeRequestHandler(request, reply);
   return reqHandler<OrganizationDetailsViewProps>(
     OrganizationDetailsView.name,
     {
+      title: organization.displayName || `@${organization.slug}`,
       organization,
-    }
+    },
   );
 };
 

app/controllers/pipelines/getPipelinesView.ts
@@ -60,6 +60,7 @@ const getRepositoryPipelinesView: ReqHandler<
 
   const reqHandler = reply.makeRequestHandler(request, reply);
   return reqHandler<PipelinesViewProps>(PipelinesView.name, {
+    title: `${repo.displayName || repo.slug} | Pipelines`,
     parentOrg,
     pipelines,
     repo,

app/controllers/repository/getRepositoryBrowserView.ts
@@ -3,8 +3,8 @@ import type { ReqHandler } from "@ethicdevs/react-monolith";
 // generated via script[generate:prisma]
 import { ResourceVisibility } from "@prisma/client";
 // app
-import { AppRoute, AppRouteParams } from "../../routes.defs";
 import { Const } from "../../const";
+import { AppRoute, AppRouteParams } from "../../routes.defs";
 // app services
 import { makeOrganizationService } from "../../services/organization";
 import { makeRepositoryService } from "../../services/repository";

...
@@ -56,7 +56,7 @@ const getRepositoryBrowserView: ReqHandler<
     repo,
     path,
     currentRef,
-    true
+    true,
   );
 
   const lastCommit = commitLogs.length >= 1 ? commitLogs[0] : null;

...
@@ -73,7 +73,7 @@ const getRepositoryBrowserView: ReqHandler<
       Const.README_FILE_NAMES,
       currentRef === Const.PRIMARY_BRANCH_REF
         ? Const.DEFAULT_HEAD_REF
-        : currentRef
+        : currentRef,
     );
 
     const readmeFileContent =

...
@@ -83,7 +83,7 @@ const getRepositoryBrowserView: ReqHandler<
             `${path}${readmeFiles[0]}`,
             currentRef === Const.PRIMARY_BRANCH_REF
               ? Const.DEFAULT_HEAD_REF
-              : currentRef
+              : currentRef,
           )
         : null;
 

...
@@ -106,9 +106,8 @@ const getRepositoryBrowserView: ReqHandler<
     });
   }
 
-  let linguistInfos = await request.codeAnalysisService.getLinguistFileInfos(
-    path
-  );
+  let linguistInfos =
+    await request.codeAnalysisService.getLinguistFileInfos(path);
 
   let fileContent =
     linguistInfos.type === "image"

...
@@ -121,10 +120,11 @@ const getRepositoryBrowserView: ReqHandler<
 
   linguistInfos = await request.codeAnalysisService.getLinguistFileInfos(
     path,
-    fileContent.content
+    fileContent.content,
   );
 
   return reqHandler<RepositoryBrowserViewProps>(RepositoryBrowserView.name, {
+    title: `${repo.displayName || repo.slug} | ${currentRef !== Const.DEFAULT_HEAD_REF ? `${currentRef} | ` : ""}${path != "" ? path : ""}`,
     branches,
     currentRef,
     currentUser,

app/controllers/repository/getRepositoryCommitsLogView.ts
@@ -2,6 +2,7 @@
 import type { ReqHandler } from "@ethicdevs/react-monolith";
 import { ResourceVisibility } from "@prisma/client";
 // app
+import { Const } from "../../const";
 import { AppRoute, AppRouteParams } from "../../routes.defs";
 // app services
 import { makeOrganizationService } from "../../services/organization";

...
@@ -48,18 +49,19 @@ const getRepositoryCommitsLogView: ReqHandler<
   const history = await repoService.getRepositoryCommitLog(
     repo,
     undefined,
-    currentRef
+    currentRef,
   );
 
   const reqHandler = reply.makeRequestHandler(request, reply);
   return reqHandler<RepositoryCommitsLogViewProps>(
     RepositoryCommitsLogView.name,
     {
+      title: `${repo.displayName || repo.slug} | ${currentRef !== Const.DEFAULT_HEAD_REF ? `${currentRef} | ` : ""} Commits`,
       currentRef,
       parentOrg,
       repo,
       history,
-    }
+    },
   );
 };
 

app/controllers/repository/getRepositoryCompareView.ts
@@ -49,6 +49,7 @@ const getRepositoryCompareView: ReqHandler<
 
   const reqHandler = reply.makeRequestHandler(request, reply);
   reqHandler<RepositoryCompareViewProps>(RepositoryCompareView.name, {
+    title: `${repo.displayName || repo.slug} | ${refA}..${refB} | Compare`,
     currentUser,
     filesDiffs,
     parentOrg,

app/controllers/repository/getRepositoryCreateView.ts
+ 2
- 1
@@ -21,7 +21,7 @@ const getRepositoryCreateView: ReqHandler = async (request, reply) => {
   const usersService = makeUsersService({ request });
 
   const availableParentOrgs = await usersService.getUserOrganizations(
-    request.session.data.curr_user_uid
+    request.session.data.curr_user_uid,
   );
 
   if (availableParentOrgs.length <= 0) {

...
@@ -35,6 +35,7 @@ const getRepositoryCreateView: ReqHandler = async (request, reply) => {
   }
 
   return reqHandler<RepositoryCreateViewProps>(RepositoryCreateView.name, {
+    title: "Create Repository",
     availableParentOrgs,
   });
 };

app/controllers/repository/getRepositoryDetailsView.ts
@@ -60,7 +60,7 @@ const getRepositoryDetailsView: ReqHandler<
   const readmeFiles = await repoService.isFileInRepositoryPath(
     repo,
     "",
-    Const.README_FILE_NAMES
+    Const.README_FILE_NAMES,
   );
 
   const readmeFileContent =

...
@@ -72,7 +72,7 @@ const getRepositoryDetailsView: ReqHandler<
     repo,
     "",
     currentRef,
-    true
+    true,
   );
 
   const lastCommit = commitLogs.length >= 1 ? commitLogs[0] : null;

...
@@ -108,7 +108,7 @@ const getRepositoryDetailsView: ReqHandler<
     if (error.message.includes(`${currentRef} is not a valid object name`)) {
       return reqHandler<RepositoryDetailsViewProps>(
         RepositoryDetailsView.name,
-        props
+        props,
       );
     } else if (
       error.message.includes("Could not find a valid git repository")

...
@@ -123,16 +123,16 @@ const getRepositoryDetailsView: ReqHandler<
     props.repoFiles = await repoService.getRepositoryFiles(
       repo,
       "",
-      currentRef
+      currentRef,
     );
   } catch (err) {
     console.log(`Could not get repo files. Error: ${(err as Error).message}`);
   }
 
-  return reqHandler<RepositoryDetailsViewProps>(
-    RepositoryDetailsView.name,
-    props
-  );
+  return reqHandler<RepositoryDetailsViewProps>(RepositoryDetailsView.name, {
+    ...props,
+    title: `${repo.displayName || repo.slug} | ${currentRef !== Const.DEFAULT_HEAD_REF ? `${currentRef} | ` : ""}`,
+  });
 };
 
 export default getRepositoryDetailsView;

app/controllers/repository/getRepositoryExploreView.ts
@@ -12,6 +12,7 @@ const getRepositoryExploreView: ReqHandler = async (request, reply) => {
 
   const reqHandler = reply.makeRequestHandler(request, reply);
   return reqHandler<RepositoryExploreViewProps>(RepositoryExploreView.name, {
+    title: "Explore Repositories",
     repositories: await repoService.getRepositoryExploreCollection(),
   });
 };

app/controllers/repository/getRepositoryForkView.ts
@@ -31,9 +31,8 @@ const getRepositoryForkView: ReqHandler<
   const repoService = makeRepositoryService({ request });
   const usersService = makeUsersService({ request });
 
-  const sourceParentOrg = await organizationService.getOrganizationBySlug(
-    orgSlug
-  );
+  const sourceParentOrg =
+    await organizationService.getOrganizationBySlug(orgSlug);
 
   if (sourceParentOrg == null) {
     return reply.status(404).callNotFound();

...
@@ -46,7 +45,7 @@ const getRepositoryForkView: ReqHandler<
   }
 
   let availableParentOrgs = await usersService.getUserOrganizations(
-    request.session.data.curr_user_uid
+    request.session.data.curr_user_uid,
   );
 
   let isForkable: boolean = true;

...
@@ -67,6 +66,7 @@ const getRepositoryForkView: ReqHandler<
   }
 
   return reqHandler<RepositoryForkViewProps>(RepositoryForkView.name, {
+    title: `${sourceParentOrg.displayName || "@" + sourceParentOrg.slug}/${sourceRepo.displayName || sourceRepo.slug} | Fork`,
     availableParentOrgs,
     errorMessage,
     isForkable,

app/controllers/repository/getRepositoryShowObjectView.ts
@@ -51,7 +51,7 @@ const getRepositoryShowObjectView: ReqHandler<
       ? await repoService.getRepositoryRefDiff(
           repo,
           gitObject.parent,
-          gitObject.commit
+          gitObject.commit,
         )
       : null;
 

...
@@ -59,11 +59,12 @@ const getRepositoryShowObjectView: ReqHandler<
   return reqHandler<RepositoryShowObjectViewProps>(
     RepositoryShowObjectView.name,
     {
+      title: `${parentOrg.displayName || "@" + parentOrg.slug}/${repo.displayName || repo.slug} | Show object: ${objectId}`,
       parentOrg,
       repo,
       gitObject,
       gitObjectDiffs,
-    }
+    },
   );
 };
 

app/controllers/repositoryPullRequests/getRepositoryPullRequestCreateView.ts
@@ -48,9 +48,8 @@ const getRepositoryPullRequestCreateView: ReqHandler<
 
   const branches = await repoService.getRepositoryBranches(repo);
 
-  const currentUserForks = await repoService.getCurrentUserRepositoryForks(
-    repo
-  );
+  const currentUserForks =
+    await repoService.getCurrentUserRepositoryForks(repo);
 
   const currentUserForksRepos = await currentUserForks.reduce(
     async (accP, r) => {

...
@@ -69,13 +68,13 @@ const getRepositoryPullRequestCreateView: ReqHandler<
         repo: RepositoryWithParentAndForkedFromRepos;
         branches: string[];
       };
-    }>
+    }>,
   );
 
   // Inject PR target's repository first.
   const [personalOrg] = await usersService.getUserOrganizations(
     request.session.data.curr_user_uid,
-    true // personalOnly
+    true, // personalOnly
   );
 
   const sources: {

...
@@ -147,12 +146,11 @@ const getRepositoryPullRequestCreateView: ReqHandler<
 
     if (matches != null && Array.isArray(matches)) {
       const [_, targetOrgSlug, targetRepoSlug, targetFromBranch] = matches;
-      const targetParentOrg = await orgService.getOrganizationBySlug(
-        targetOrgSlug
-      );
+      const targetParentOrg =
+        await orgService.getOrganizationBySlug(targetOrgSlug);
       const targetRepo = await repoService.getRepository(
         targetOrgSlug,
-        targetRepoSlug
+        targetRepoSlug,
       );
 
       if (targetParentOrg == null || targetRepo == null) {

...
@@ -179,12 +177,13 @@ const getRepositoryPullRequestCreateView: ReqHandler<
   return reqHandler<RepositoryPullRequestCreateViewProps>(
     RepositoryPullRequestCreateView.name,
     {
+      title: `${repo.displayName || repo.slug} | Draft a new Pull Request`,
       errorMessage: null,
       initialValues: {},
       parentOrg,
       repo,
       variant,
-    }
+    },
   );
 };
 

app/controllers/repositoryPullRequests/getRepositoryPullRequestDetailsView.ts
@@ -157,6 +157,7 @@ const getRepositoryPullRequestDetailsView: ReqHandler<
   return reqHandler<RepositoryPullRequestDetailsViewProps>(
     RepositoryPullRequestDetailsView.name,
     {
+      title: `${sourceRepo.displayName || sourceRepo.slug} | Pull Request | #${pullRequest.uid} - ${pullRequest.summary}`,
       filesDiffs,
       lastCommit,
       pullRequest,

app/controllers/repositoryPullRequests/getRepositoryPullRequestsView.ts
@@ -62,6 +62,7 @@ const getRepositoryPullRequestsView: ReqHandler<
   return reqHandler<RepositoryPullRequestsViewProps>(
     RepositoryPullRequestsView.name,
     {
+      title: `${repo.displayName || repo.slug} | Pull Requests`,
       parentOrg,
       pullRequests,
       repo,

app/controllers/settings/getSettingsView.ts
@@ -10,7 +10,7 @@ import SettingsView, {
 
 const getSettingsView: ReqHandler<AppRouteParams, AppRoute.SETTINGS> = async (
   request,
-  reply
+  reply,
 ) => {
   const { curr_user_username } = request.session.data;
 

...
@@ -27,6 +27,7 @@ const getSettingsView: ReqHandler<AppRouteParams, AppRoute.SETTINGS> = async (
 
   const reqHandler = reply.makeRequestHandler(request, reply);
   return reqHandler<SettingsViewProps>(SettingsView.name, {
+    title: "Settings > SSH Keys",
     sshKeys: await usersService.getUserSSHKeys(user),
   });
 };

app/controllers/settings/keys/getKeysListView.ts
@@ -28,6 +28,7 @@ const getKeysListView: ReqHandler<
 
   const reqHandler = reply.makeRequestHandler(request, reply);
   return reqHandler<SettingsViewProps>(SettingsView.name, {
+    title: "Settings | SSH Keys",
     sshKeys: await usersService.getUserSSHKeys(user),
   });
 };

app/controllers/user/getUserDashboardView.ts
@@ -28,6 +28,7 @@ const getUserDashboardView: ReqHandler = async (request, reply) => {
 
   const reqHandler = reply.makeRequestHandler(request, reply);
   return reqHandler<UserDashboardViewProps>(UserDashboardView.name, {
+    title: `@${currentUser.username} | Dashboard`,
     currentUser,
     repositories,
   });

app/controllers/user/getUserDetailsView.ts
@@ -31,6 +31,7 @@ const getUserDetailsView: ReqHandler<
 
   const reqHandler = reply.makeRequestHandler(request, reply);
   return reqHandler<UserDetailsViewProps>(UserDetailsView.name, {
+    title: `@${username}`,
     currentUser,
     user,
     repositories: await usersService.getUserRepositories(user),

app/utils/server/makeRequestHandler.ts
@@ -26,6 +26,8 @@ export const makeRequestHandler = {
 
         const title = props != null ? props.title : viewName;
 
+        console.log("title:", title);
+
         const themeSchemeFromCookies =
           "theme_scheme" in request.cookies
             ? request.cookies["theme_scheme"].split(".")[0]