Skip to content

Initial setup and layout #1

Merged
AlemTuzlak merged 45 commits intomainfrom
initial-setup-and-layout
Aug 21, 2025
Merged

Initial setup and layout #1
AlemTuzlak merged 45 commits intomainfrom
initial-setup-and-layout

Conversation

@abrulic
Copy link
Copy Markdown
Collaborator

@abrulic abrulic commented Jul 24, 2025

Description

Initial working UI that contains a sidebar, table of contents, and rendered styled .mdx files, theme toggle, etc.
Added reusable components like the sidebar, code block, etc.
Added reusable UI primitives like alert dialog, icon button, etc.

Remaining vitest tests will be included in #4, with additional improvements in that issue's PR.

recording-2025-08-21-13-38-45.webm

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 25, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 95.26% 302 / 317
🔵 Statements 95.26% 302 / 317
🔵 Functions 96.66% 29 / 30
🔵 Branches 98.73% 78 / 79
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
app/components/code-block/code-block-diff.ts 100% 100% 100% 100%
app/components/code-block/code-block-parser.ts 66.66% 100% 80% 66.66% 29-42
app/components/code-block/code-block-syntax-highlighter.ts 100% 100% 100% 100%
app/components/sidebar/build-breadcrumbs.tsx 100% 100% 100% 100%
app/utils/local-storage.ts 77.77% 66.66% 100% 77.77% 6-7
app/utils/split-slug.ts 100% 100% 100% 100%
Generated in workflow #28 for commit f3a6b68 by the Vitest Coverage Report Action

@abrulic abrulic changed the title Initial setup and layout Initial setup and layout [DRAFT] Jul 28, 2025
Copy link
Copy Markdown

@thomasfr thomasfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the last version you shows in mondays meeting? I think i am missing some files, or?

In the content folder, is it necessary and if yes, why is i necessary to have a subfolder v1.0.1?

Comment on lines +19 to +29
const handleMouseEnter = (e: React.MouseEvent<HTMLButtonElement>) => {
if (copyState !== "copied") {
e.currentTarget.style.backgroundColor = "var(--color-code-copy-hover-bg)"
}
}

const handleMouseLeave = (e: React.MouseEvent<HTMLButtonElement>) => {
if (copyState !== "copied") {
e.currentTarget.style.backgroundColor = "transparent"
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do this with JS, couldn't you have done this with css? just conditionally render classes needed to do this based on copy state

* @param previous - Optional previous page link data with title and path.
* @param next - Optional next page link data with title and path.
*/
export function Pager({ previous, next }: PagerProps) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you call this pager?


export const DesktopSidebarPanel = ({ items, className }: { items: SidebarSection[]; className: string }) => (
<div
className={`sticky top-[var(--header-height)] h-[calc(100vh-var(--header-height))] w-80 flex-col overflow-hidden bg-[var(--color-background)] p-4 ${className}`}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cn


return (
<div>
<a
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this a normal link?

Comment on lines +25 to +26
{theme === "light" && <IconButton aria-label="Switch to dark mode" name="Sun" onClick={toggle} />}
{theme === "dark" && <IconButton aria-label="Switch to light mode" name="Moon" onClick={toggle} />}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why two, why not one, extract the check into const isDarkTheme = theme === "dark" then render conditionally based on that, if you don't support the system theme obviously

Comment on lines +6 to +7
GITHUB_OWNER: z.string(),
GITHUB_REPO: z.string(),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both of these are optional, that's correct?

export default flatRoutes({
ignoredRouteFiles: ["**/*.test.{ts,tsx}"],
})
export default [
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you manually define routes?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abrulic any answer?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I defined them manually so it is easier to follow the routes. I think this way is cleaner for the template

Comment on lines +9 to +10
// TODO sidebarItems are used on 2 places, change this to not call getSidebarTree twice
const sidebarItems = createSidebarTree("v1.0.1") //TODO use the version what is selected from the dropdown, after implementing docs generation
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create issues, don't just write TODO in the code


if (href && !isActive) {
return (
<a href={href} className={classes}>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a tags cause full document reload requests, why are you using them instead of ?

map.get(parent)?.documentationPages.push({ slug: p.slug, title: p.title })
}

return [...map.values()].filter((n) => parentOf(n.slug) === version)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could've been a constant with a descriptive name, i have no idea what this is

Comment on lines +14 to +19
.replace(/`([^`]+)`/g, "$1")
.replace(/\*\*([^*]+)\*\*/g, "$1")
.replace(/\*([^*]+)\*/g, "$1")
.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1")
.replace(/\{[^}]*\}/g, "")
.replace(/<\/?[^>]+(>|$)/g, "")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments on what this does would go a long way

@@ -0,0 +1,16 @@
export function splitSlug(slug: string) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

always test utils

Copy link
Copy Markdown
Collaborator Author

@abrulic abrulic Aug 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this funciton has tests in tests folder, maybe another utils don't have but I created another issue to add missing tests

Copy link
Copy Markdown
Collaborator

@AlemTuzlak AlemTuzlak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small changes, all in all very good

@abrulic
Copy link
Copy Markdown
Collaborator Author

abrulic commented Aug 13, 2025

Is this the last version you shows in mondays meeting? I think i am missing some files, or?

In the content folder, is it necessary and if yes, why is i necessary to have a subfolder v1.0.1?

removed "v1.0.1"

@abrulic abrulic requested review from AlemTuzlak and thomasfr August 14, 2025 07:58
@abrulic
Copy link
Copy Markdown
Collaborator Author

abrulic commented Aug 21, 2025

@AlemTuzlak @thomasfr This one is ready for review

Copy link
Copy Markdown

@thomasfr thomasfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks. I havent looked into all the components and hooks though.

export function ThemeToggle() {
const [theme, setTheme] = useState<"light" | "dark" | null>(null)

useLayoutEffect(() => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on using this hook

@AlemTuzlak AlemTuzlak merged commit 3e5c7e6 into main Aug 21, 2025
4 checks passed
@abrulic abrulic deleted the initial-setup-and-layout branch September 24, 2025 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants