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
Binary file added public/duck.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/app/api/hooks/github/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const privateKey = Buffer.from(GITHUB_PRIVATE_KEY_BASE_64!!, 'base64').toString(
// we will only add comments in these repos for now
const repositoryWhitelist = [
'example-openapi',
'test-openapi'
'test-openapi',
'moonboon-openapi'
]

const webhooks = new Webhooks({ secret: GITHUB_WEBHOOK_SECRET!! })
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/DocumentationViewerComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import RedoclyComponent from "./RedoclyComponent";
import { getSettings } from "../utils/SettingsUtils";
import { subscribe, unsubscribe } from "../utils/EventsUtils";
import { Events } from "../events/BaseEvent";
import { useEffect, useState } from "react";
import { useEffect } from "react";
import { useForceUpdate } from "../utils/Hooks";

export enum DocumentationVisualizer {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { SelectChangeEvent, Select, MenuItem } from "@mui/material";
import { SelectChangeEvent, Select, MenuItem, Divider } from "@mui/material";
import { useState } from "react";
import { IOpenApiSpecification } from "../projects/IOpenAPISpecification";
import OpenApiSpecificationChangedEvent from "../events/OpenApiSpecificationChangedEvent";
Expand Down Expand Up @@ -40,6 +40,8 @@ const OpenApiSpecificationSelectorComponent: React.FC<
value={openAPISpecification}
label="Open API Specification"
onChange={handleVersionChange}
sx={{ boxShadow: 'none', '.MuiOutlinedInput-notchedOutline': { border: 0 } }}
autoWidth
>
{openApiSpecifications.map((openApiSpecification, index) => {
return (
Expand Down
10 changes: 8 additions & 2 deletions src/lib/components/VersionSelectorComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { MenuItem, Select, SelectChangeEvent } from "@mui/material";
import { MenuItem, Select, SelectChangeEvent, Divider } from "@mui/material";
import { IVersion } from "../projects/IVersion";
import { useState } from "react";
import { getProject, getVersion } from "../utils/UrlUtils";
Expand Down Expand Up @@ -34,7 +34,13 @@ const VersionSelectorComponent: React.FC<VersionSelectorComponentProps> = ({
};

return (
<Select value={version} label="Version" onChange={handleVersionChange}>
<Select
value={version}
label="Version"
onChange={handleVersionChange}
sx={{ boxShadow: 'none', '.MuiOutlinedInput-notchedOutline': { border: 0 } }}
autoWidth
>
{versions.map((version, index) => {
return (
<MenuItem key={`Version-${index}`} value={version.name}>
Expand Down
6 changes: 4 additions & 2 deletions src/lib/pages/WelcomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const WelcomePage: React.FC = () => {
return <h1>Welcome</h1>
return <div style={{ display: "flex", justifyContent: "center", alignItems: "center", height: "100vh", width: "100vw", position: "fixed", top: "0", left: "0" }}>
<img src="/duck.png" alt="Duck" width={300} />
</div>
}

export default WelcomePage;
export default WelcomePage;
6 changes: 4 additions & 2 deletions src/lib/projects/GitHubProjectRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export class GitHubProjectRepository implements IProjectRepository {
return {
name: defaultName,
repository: repository.name,
owner: repository.owner
owner: repository.owner,
defaultBranch: repository.defaultBranch
}
}
const configResponse: INetworkResponse<string> = await this.networkClient.get({
Expand All @@ -51,7 +52,8 @@ export class GitHubProjectRepository implements IProjectRepository {
name: config.name || defaultName,
image: imageURL,
repository: repository.name,
owner: repository.owner
owner: repository.owner,
defaultBranch: repository.defaultBranch
}
}

Expand Down
21 changes: 19 additions & 2 deletions src/lib/projects/GitHubVersionRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,34 @@ export class GitHubVersionRepository implements IVersionRepository {
repository: project.name,
name: b.name
}
}).sort((a, b) => {
return a.name.localeCompare(b.name)
})
let candidateDefaultBranches = ["main", "master", "develop", "development"]
if (project.defaultBranch) {
candidateDefaultBranches.splice(0, 0, project.defaultBranch)
}
// Reverse them so the top-priority branches end up at the top of the list.
candidateDefaultBranches = candidateDefaultBranches.reverse()
// Move the top-priority branches to the top of the list.
for (const candidateDefaultBranch of candidateDefaultBranches) {
const defaultBranchIndex = branchVersions.findIndex(e => e.name === candidateDefaultBranch)
if (defaultBranchIndex !== -1) {
const defaultBranchVersion = branchVersions[defaultBranchIndex]
delete branchVersions[defaultBranchIndex]
branchVersions.splice(0, 0, defaultBranchVersion)
}
}
const tagVersions = tags.map(t => {
return {
owner: project.owner,
repository: project.name,
name: t.name
}
})
return tagVersions.concat(branchVersions).sort((a, b) => {
}).sort((a, b) => {
return a.name.localeCompare(b.name)
})
return branchVersions.concat(tagVersions)
})
}
}
1 change: 1 addition & 0 deletions src/lib/projects/IGitHubProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import { IProject } from "./IProject";
export interface IGitHubProject extends IProject {
readonly owner: string
readonly repository: string
readonly defaultBranch: string
}