Skip to content

Conversation

@josh-wong
Copy link
Member

@josh-wong josh-wong commented Mar 17, 2025

Description

This PR adds a support dropdown menu to the right-hand sidebar of pages, above the table of contents on the docs site. The support dropdown menu includes the links to the following:

  • Contact technical support
    • This link directs visitors to a form on the Scalar technical support portal, where they can submit an issue to receive technical support.
      • Because of a limitation with the support service platform, a link to the page cannot be added to the form unless the visitor is already logged in to the technical support portal.
      • If the visitor is not logged in, they will still be taken to the form to submit an issue, but the URL will not be prefilled out.
    • Technical support is only for customers with a commercial license.
  • Ask AI (experimental)
    • This link opens a modal window that contains the Scalar docs AI assistant.
    • The AI assistant is only for members of the Scalar Membership Program.
  • Report doc issue
    • This link directs visitors to the GitHub issues page.
    • In that issue is a template for visitors to fill out.
      • If the issue is reported from a page in English, the template will be in English.
      • If the issue is reported from a page in Japanese, the template will be in Japanese.
      • Any visitor can submit an issue about a doc.

Note

  • The support dropdown menu doesn't appear on the home page because doing so doesn't provide much value (We want to encourage visitors to navigate the docs after visiting the home page). We'll be updating the home page in the future, so we can think about if we actually want to include it.

Related issues and/or PRs

N/A

Changes made

  • Swizzled the Layout component, which contains the table of contents, and added links for the following:
    • Contact technical support
    • Ask AI (experimental) (modal)
    • Report doc issue
  • For the Ask AI (experimental) modal, created AssistantModal.tsx and implemented the AI assistant based on the Typebot deployment method by using the @typebot.io/react npm package.
  • Styled the support button and links to match the look and feel of similar buttons and dropdown menus in Docusaurus.

Checklist

The following is a best-effort checklist. If any items in this checklist are not applicable to this PR or are dependent on other, unmerged PRs, please still mark the checkboxes after you have read and understood each item.

  • I have updated the side navigation as necessary.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

To see the support dropdown menu in the staged version of the docs site, please see the autogenerated comment from Netlify my comment with a link to our Netlify staging site in this PR.

This component has been swizzled so that we can add a support dropdown menu.
This is called when the user clicks the AI Assistant button in the Support dropdown menu.
This is called when the user clicks the Contact Technical Support button in the Support dropdown menu.
Before this change, the Support button would only appear if the page had a ToC.
By making the Support button static above the ToC, visitors can access the button without having to scroll to the top of the page.
Some pages purposely hide the ToC by using `hide_table_of_contents: true`. We don't want the Support button to appear on those pages since the contents of the page are wider (taking up the space where the ToC would be).
When the `zIndex` is too high, the Support button and ToC appear on top of the language dropdown menu. reducing the `zIndex` makes the language dropdown menu appear over the Support button and ToC.
No longer needed since I added styles to custom.css.
These styles were originally in src/css/SupportDropdownMenu.module.css.
`ReactNode` should be used since it's what Docusaurus is based on.
Styles exist in the custom.css file now rather than a separate CSS file
Combined the contents into "src/components/Support/SupportDropdownMenu.tsx" for easier manageability.
Added the contents from "src/components/Support/ContactSupportLink.tsx" for easier manageability.
Using an absolute link shows as an error for some reason. Changing the absolute link to a relative link doesn't show an error and still imports the component.
Need to adjust the width and padding to accommodate changes to the wording.
josh-wong added 18 commits March 6, 2025 18:57
Simply `Need help?` results in the arrow being a little too far away from the text. Being a little casual here fixes that.
The component was move in 18027a5, so this import needs to be updated to reflect that.
We decided not to use Font Awesome icons in this component, so we don't need to refer to this plugin here.
This file isn't needed since we can manage the AI assistants in a single file: b160ea8
This reverts commit b530b67.
The GitHub issue link was opening a new tab with the same page that the visitor was on.
Change dropdown item font color to match the default color of other fonts in Docusaurus.
@josh-wong josh-wong added the enhancement New feature or request label Mar 17, 2025
@josh-wong josh-wong self-assigned this Mar 17, 2025
@netlify
Copy link

netlify bot commented Mar 17, 2025

Deploy Preview for staging-scalardb-docs-site failed. Why did it fail? →

Name Link
🔨 Latest commit 743015c
🔍 Latest deploy log https://app.netlify.com/sites/staging-scalardb-docs-site/deploys/67d7bb7033b2fc0008d83eb3

@josh-wong
Copy link
Member Author

josh-wong commented Mar 17, 2025

@ypeckstadt @thongdk8 I think the docs site is too heavy for Netlify, which is why it fails being deployed automatically (build and deploys fine in GitHub and locally though).

I've added the sites build files and deployed the site manually at the following link instead: https://67d42e0200dd904b345906a2--clinquant-beijinho-49680d.netlify.app

@josh-wong josh-wong merged commit bd5d1e5 into main Mar 21, 2025
1 of 5 checks passed
@josh-wong josh-wong deleted the feature/add-support-dropdown branch March 21, 2025 00:34
josh-wong added a commit that referenced this pull request May 14, 2025
* Swizzle component to add support dropdown menu

This component has been swizzled so that we can add a support dropdown menu.

* Add `@typebot.io/react`

* Create AssistantModal.tsx

This is called when the user clicks the AI Assistant button in the Support dropdown menu.

* Create ContactSupportLink.tsx

This is called when the user clicks the Contact Technical Support button in the Support dropdown menu.

* Create SupportDropdownMenu.tsx

* Create SupportDropdownMenu.module.css

* Add Support dropdown menu above TOC

* Make Support button appear with or without ToC

Before this change, the Support button would only appear if the page had a ToC.

* Pass URL as parameter to Typebot

* Show Japanese text on Japanese version of site

* Justify alignment for Support button text and arrow icon

* Make Support button appear static above ToC

By making the Support button static above the ToC, visitors can access the button without having to scroll to the top of the page.

* Hide Support button when hiding ToC on page

Some pages purposely hide the ToC by using `hide_table_of_contents: true`. We don't want the Support button to appear on those pages since the contents of the page are wider (taking up the space where the ToC would be).

* Re-order styles

* Show Support button on mobile

* Make Support button and ToC appear behind language dropdown

When the `zIndex` is too high, the Support button and ToC appear on top of the language dropdown menu. reducing the `zIndex` makes the language dropdown menu appear over the Support button and ToC.

* Revise code comments for clarity

* Fix spelling

* Add support for dark mode

* Delete SupportDropdownMenu.module.css

No longer needed since I added styles to custom.css.

* Add Support button styles

These styles were originally in src/css/SupportDropdownMenu.module.css.

* Change from using `JSX.Element` to `ReactNode`

`ReactNode` should be used since it's what Docusaurus is based on.

* Add GitHub issue link and template

* Fix styles

Styles exist in the custom.css file now rather than a separate CSS file

* Revise wording on links

* Delete ContactSupportLink.tsx

Combined the contents into "src/components/Support/SupportDropdownMenu.tsx" for easier manageability.

* Update SupportDropdownMenu.tsx

Added the contents from "src/components/Support/ContactSupportLink.tsx" for easier manageability.

* Change component link from absolute to relative

Using an absolute link shows as an error for some reason. Changing the absolute link to a relative link doesn't show an error and still imports the component.

* Adjust width and padding for Support button

Need to adjust the width and padding to accommodate changes to the wording.

* Specify Support dropdown arrow size

The dropdown arrow size should be specified here since doing so in the component causes a flash of unstyled content.

* Revised wording in dropdown

* Update font style and link behavior

* Refactor support dropdown to fix errors on build

This refactor is necessary because the error `[cause]: TypeError: Layout_styles_module_default is not a function` occurred. After trying to fix this issue by changing the import for **styles.module.css** to the global **custom.css** file instead, the error `[cause]: ReferenceError: Cannot access 'SupportDropdownMenu' before initialization` occurred. This refactor resolves those issues by ensuring that the support dropdown menu component is initialized first before the Layout component is built.

* Hide Stack Overflow link

We've decided to not show the Stack Overflow link for now. Commented it out so that we can easily show it later.

* Make dropdown menu appear on hover (instead of on click)

Making the dropdown menu appear on hover instead of on click matches the natural behavior of other dropdown menus in Docusaurus.

* Modify support dropdown menu styles

Styles modified to support on-hover behavior instead of on-click behavior and to make the dropdown transitions match the transitions of other dropdown menus in Docusaurus.

* Change dropdown arrow icon

Changed the arrow icon to match the same icon used in other dropdown menus in Docusaurus.

* Fix support dropdown from disappearing

This style keeps the support button dropdown menu open when moving the mouse between the button text and icon.

* Put support button styles in alphabetical order

* Make support button font consistent with other buttons

* Add `some` to English button

Simply `Need help?` results in the arrow being a little too far away from the text. Being a little casual here fixes that.

* Remove comments that were for quick, personal reference

* Add rounded corners to dropdown and on link hover

* Move file

* Move file

* Update import

The component was move in 18027a5, so this import needs to be updated to reflect that.

* Create AssistantModal.tsx

* Update link to chatbot

* Remove Font Awesome plugin

We decided not to use Font Awesome icons in this component, so we don't need to refer to this plugin here.

* Show AI assistant based on language

* Move back to `Support` folder

* Delete AssistantModal.tsx

This file isn't needed since we can manage the AI assistants in a single file: b160ea8

* Revert "Update import"

This reverts commit b530b67.

* Fix GitHub issue link

The GitHub issue link was opening a new tab with the same page that the visitor was on.

* Change dropdown item font color

Change dropdown item font color to match the default color of other fonts in Docusaurus.

* Hide support dropdown menu from home page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant