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
2 changes: 1 addition & 1 deletion src/app/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default async function Page({
<App
userComponent={<UserComponent user={user} />}
projectListComponent={
<ProjectListComponent projectRepository={projectRepository} />
<ProjectListComponent projectRepository={projectRepository} projectName={projectName}/>
}
{...(projectName && projectName.length > 0
? {
Expand Down
27 changes: 11 additions & 16 deletions src/lib/components/AppBarComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,19 @@ const AppBarComponent: React.FC<AppBarComponentProps> = ({
justifyContent: "center",
}}
>
<Image
src={ShapeLogo}
alt="Shape logo"
style={{
marginLeft: "auto",
}}
/>
<Box
sx={{
marginLeft: "auto",
marginRight: "10px",
}}
>
{versionSelectorComponent ?? <></>}
{openApiSpecificationsComponent ?? <></>}
</Box>
<Image src={ShapeLogo} alt="Shape logo" />
</Box>
<Divider />
<Box
sx={{
position: "fixed",
right: "15px",
marginRight: "10px",
}}
>
{versionSelectorComponent ?? <></>}
{openApiSpecificationsComponent ?? <></>}
</Box>
</AppBar>
);
};
Expand Down
18 changes: 13 additions & 5 deletions src/lib/components/ProjectComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { Avatar, ListItem, ListItemButton, ListItemText } from "@mui/material";
import { Avatar, ListItem, ListItemButton, ListItemText, Typography } from "@mui/material";
import { useTheme } from "@mui/material/styles";
import { IProject } from "../projects/IProject";
import { Folder, FolderOpen } from "@mui/icons-material";
Expand All @@ -14,15 +14,14 @@ import { IGitHubProject } from "../projects/IGitHubProject";

interface ProjectComponentProps {
project: IGitHubProject;
selectedProject: boolean;
}

const ProjectComponent: React.FC<ProjectComponentProps> = ({ project }) => {
const [selectedProject, setSelectedProject] = useState(false);
const ProjectComponent: React.FC<ProjectComponentProps> = ({ project, selectedProject }) => {
const router = useRouter();

const selectProject = () => {
router.push(`/${project.repository.replace("-openapi", "")}`);
setSelectedProject(true);
};
const theme = useTheme();

Expand All @@ -47,7 +46,16 @@ const ProjectComponent: React.FC<ProjectComponentProps> = ({ project }) => {
sx={{ width: 35, height: 35, marginRight: "10px" }}
/>
)}
<ListItemText primary={project.name} />
{selectedProject &&
<ListItemText
primary={
<Typography style={{ color: theme.palette.secondary.light, fontWeight: 'bold' }}>
{project.name}
</Typography>
}
/>
}
{!selectedProject && <ListItemText primary={project.name} /> }
</ListItemButton>
</ListItem>
);
Expand Down
7 changes: 6 additions & 1 deletion src/lib/components/ProjectListComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@ import { List, Divider } from "@mui/material";
import ProjectComponent from "./ProjectComponent";
import { IProjectRepository } from "../projects/IProjectRepository";
import { IGitHubProject } from "../projects/IGitHubProject";
import { getProject } from "../utils/UrlUtils";

interface ProjectListComponentProps {
projectRepository: IProjectRepository;
projectName?: string;
}

const ProjectListComponent: React.FC<ProjectListComponentProps> = async ({
projectRepository,
projectName
}) => {
const projects = (await projectRepository.getProjects()) as IGitHubProject[];
console.log(projects, projects)
console.log(projectName, projectName)
// projects.push(...projects);
// projects.push(...projects);
// projects.push(...projects);
Expand All @@ -32,7 +37,7 @@ const ProjectListComponent: React.FC<ProjectListComponentProps> = async ({
>
{projects.map((project, index) => (
<div key={index}>
<ProjectComponent project={project} />
<ProjectComponent project={project} selectedProject={projectName == project.repository} />
{index < projects.length - 1 && <Divider />}
</div>
))}
Expand Down