Skip to content

Conversation

@mdroidian
Copy link
Contributor

@mdroidian mdroidian commented Aug 29, 2025

image

Summary by CodeRabbit

  • New Features

    • Display the app’s version and build date in the Settings screen (bottom-right).
  • UI/Style

    • Refined the Settings footer layout; “Send Feedback” button repositioned within a bottom-left container for improved alignment.
  • Chores

    • Build now embeds version and build date for runtime display, improving traceability across releases.

…tion

- Added `getVersion` and `getBuildDate` functions to retrieve version and build date from package.json, improving build metadata handling.
- Updated the compile function to include version and build date in the global window object.
- Refactored Settings component to display version and build date in the UI, enhancing user awareness of the application version.
@linear
Copy link

linear bot commented Aug 29, 2025

@supabase
Copy link

supabase bot commented Aug 29, 2025

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@mdroidian
Copy link
Contributor Author

@CodeRabbit full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 29, 2025

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 29, 2025

📝 Walkthrough

Walkthrough

Adds build-time injection of version and build date via esbuild, exposes them on window, introduces a runtime utility to read these values, and updates the Settings UI to show version/build date while adjusting the feedback button layout.

Changes

Cohort / File(s) Summary of Changes
Build tooling: version/date injection
apps/roam/scripts/compile.ts
Added helpers getVersion() and getBuildDate(); extended esbuild define to inject window.DISCOURSE_GRAPH_VERSION and window.DISCOURSE_GRAPH_BUILD_DATE with package version and current date.
Runtime utility: version accessor
apps/roam/src/utils/getVersion.ts
New module exporting getVersionWithDate() that returns { version, buildDate } from window; added global Window typings for the injected properties.
UI: Settings footer adjustments
apps/roam/src/components/settings/Settings.tsx
Imported getVersionWithDate; restructured bottom area to a flex container; added bottom-right display of version and build date; preserved “Send Feedback” behavior.

Sequence Diagram(s)

sequenceDiagram
  participant Dev as Developer
  participant Build as compile.ts (esbuild)
  participant Win as window
  participant App as Settings.tsx
  participant Util as getVersion.ts

  Dev->>Build: Run build
  Build->>Build: Read package.json (version)<br/>Get current date (YYYY-MM-DD)
  Build->>Win: Define __DISCOURSE_GRAPH_VERSION__<br/>Define __DISCOURSE_GRAPH_BUILD_DATE__
  note over Build,Win: Values embedded at bundle time

  App->>Util: getVersionWithDate()
  Util->>Win: Read __DISCOURSE_GRAPH_VERSION__ / __DISCOURSE_GRAPH_BUILD_DATE__
  Util-->>App: { version, buildDate }
  App->>App: Render footer with version/date and feedback button
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
apps/roam/scripts/compile.ts (1)

18-20: Make build date reproducible (SOURCE_DATE_EPOCH support)

Support deterministic builds while keeping the current default.

-const getBuildDate = (): string => {
-  return new Date().toISOString().split("T")[0]; // YYYY-MM-DD format
-};
+const getBuildDate = (): string => {
+  const epoch = process.env.SOURCE_DATE_EPOCH;
+  const d = epoch ? new Date(Number(epoch) * 1000) : new Date();
+  return d.toISOString().split("T")[0]; // YYYY-MM-DD (UTC)
+};
apps/roam/src/components/settings/Settings.tsx (1)

247-249: Avoid duplicate calls and add a11y title

Call getVersionWithDate() once and reuse; add a helpful title.

-        <span className="text-xs text-gray-500">
-          v{getVersionWithDate().version}-{getVersionWithDate().buildDate}
-        </span>
+        <span className="text-xs text-gray-500" title={`Version ${version} (${buildDate})`}>
+          v{version}-{buildDate}
+        </span>

Add (outside the selected lines), near the top of SettingsDialog before return:

const { version, buildDate } = getVersionWithDate();
apps/roam/src/utils/getVersion.ts (1)

1-7: Consider avoiding global Window augmentation for narrow fields

To reduce coupling (per maintainers’ preference), consider switching to define-injected module constants (e.g., __DG_VERSION__, __DG_BUILD_DATE__) instead of augmenting Window. If you keep globals, this is fine, but it does slightly pollute the global surface.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e8c4576 and e86a373.

📒 Files selected for processing (3)
  • apps/roam/scripts/compile.ts (2 hunks)
  • apps/roam/src/components/settings/Settings.tsx (2 hunks)
  • apps/roam/src/utils/getVersion.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-07-08T14:51:55.299Z
Learnt from: maparent
PR: DiscourseGraphs/discourse-graph#0
File: :0-0
Timestamp: 2025-07-08T14:51:55.299Z
Learning: DiscourseGraphs maintainers prefer not to add narrowly typed definitions for individual `process.env` keys to avoid unnecessary coupling.

Applied to files:

  • apps/roam/scripts/compile.ts
🔇 Additional comments (3)
apps/roam/scripts/compile.ts (1)

165-166: I wasn’t able to confirm whether the define block in apps/roam/scripts/compile.ts actually contains the two window.__DISCOURSE_GRAPH_*__ entries or if a banner option is already set in the esbuild config. Please manually verify that:

  • The define mapping includes
    "window.__DISCOURSE_GRAPH_VERSION__": `"${getVersion()}"`,
    "window.__DISCOURSE_GRAPH_BUILD_DATE__": `"${getBuildDate()}"`
    
  • There is no existing banner: { js: … } property in the same build options object.
apps/roam/src/components/settings/Settings.tsx (2)

28-28: LGTM: import placement and naming


234-245: LGTM: feedback button container repositioning

Layout change is safe; behavior unchanged.

…ency

- Updated `getVersion` function to accept a root parameter, enhancing flexibility in reading package.json.
- Changed default return values to "-" for better clarity in case of errors.
- Enhanced `getVersionWithDate` to handle server-side rendering by returning default values when window is undefined.
- Updated `getVersion` function to remove the root parameter, simplifying its usage by directly reading from the current working directory.
- Improved error handling with a warning for failed attempts to read version from package.json.
- Adjusted the compile function to reflect the changes in `getVersion`, ensuring consistent version retrieval.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants