Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/features/projects/view/ProjectsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { session } from "@/composition"
import { ProjectRepository } from "../domain"
import ClientProjectsPage from "./client/ProjectsPage"

Expand All @@ -12,9 +13,11 @@ export default async function ProjectsPage({
versionId?: string
specificationId?: string
}) {
const isGuest = await session.getIsGuest()
const projects = await projectRepository.get()
return (
<ClientProjectsPage
enableGitHubLinks={!isGuest}
projects={projects}
projectId={projectId}
versionId={versionId}
Expand Down
3 changes: 3 additions & 0 deletions src/features/projects/view/client/ProjectsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ import TrailingToolbarItem from "../toolbar/TrailingToolbarItem"
import useSidebarOpen from "@/common/state/useSidebarOpen"

export default function ProjectsPage({
enableGitHubLinks,
projects: serverProjects,
projectId,
versionId,
specificationId
}: {
enableGitHubLinks: boolean,
projects?: Project[]
projectId?: string
versionId?: string
Expand Down Expand Up @@ -98,6 +100,7 @@ export default function ProjectsPage({
}
toolbarTrailingItem={project && version && specification &&
<TrailingToolbarItem
enableGitHubLinks={enableGitHubLinks}
project={project}
version={version}
specification={specification}
Expand Down
12 changes: 9 additions & 3 deletions src/features/projects/view/toolbar/TrailingToolbarItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { faPen } from "@fortawesome/free-solid-svg-icons"

const TrailingToolbarItem = ({
enableGitHubLinks,
project,
version,
specification,
onSelectVersion,
onSelectSpecification
}: {
enableGitHubLinks: boolean,
project: Project
version: Version
specification: OpenApiSpecification
Expand All @@ -33,7 +35,11 @@ const TrailingToolbarItem = ({
alignItems="center"
sx={{ display: { xs: "none", sm: "none", md: "flex" } }}
>
<ProjectName text={project.name} url={version.url} sx={{ marginRight: 1 }} />
<ProjectName
text={project.name}
url={enableGitHubLinks ? version.url : undefined}
sx={{ marginRight: 1 }}
/>
<Typography variant="h6" sx={{ marginRight: 1 }}>/</Typography>
<VersionSelector
versions={project.versions}
Expand All @@ -48,7 +54,7 @@ const TrailingToolbarItem = ({
onSelect={onSelectSpecification}
sx={{ marginRight: 0.5 }}
/>
{specification.editURL &&
{enableGitHubLinks && specification.editURL &&
<IconButton
href={specification.editURL}
target="_blank"
Expand Down Expand Up @@ -89,7 +95,7 @@ const ProjectName = ({
)
} else {
return (
<Typography variant="body1">
<Typography variant="body1" sx={sx}>
{text}
</Typography>
)
Expand Down