Repository navigation
Conversation
… mod's comments on the website, and count switching tabs and opening the comments (part of LAZ-1708)
… (part of LAZ-1708)
| @@ -0,0 +1,8 @@ | |||
| /** The tabs of a mod's details, by their panel ids. */ | |||
There was a problem hiding this comment.
nit: browseModsTracker.ts now imports this type from a component folder. docs/frontend.md says a type shared across files goes in util/, so this could live at util/mod_details_tab/modDetailsTab.ts, next to util/empty_state_kind, which the tracker already uses. That would also give isModDetailsTab a home for a small test.
There was a problem hiding this comment.
Moved to util/mod_details_tab/modDetailsTab.ts in 9f96c6b, with a test for isModDetailsTab.
| tabListId="browse-mod-details-tabs" | ||
| tabType="secondary" | ||
| onSetSelectedTab={setTab} | ||
| onSetSelectedTab={(next) => { |
There was a problem hiding this comment.
nit: could this be a named selectTab above the return? The component is already long, and a name makes the guard easier to read.
There was a problem hiding this comment.
We keep handlers that are only used once inline, so the guard stays where the tab is wired up. Happy to name it if a second caller appears.
| } | ||
|
|
||
| setTab(next); | ||
| tracker.trackDetailsTabSelected({ mod_uid: mod.id, tab: next, previous_tab: tab }); |
There was a problem hiding this comment.
nit: the doc comment on ModDetails (line 57) still says it counts opening the mod page and the gallery's picks and paging. It now also counts tab changes and opening comments.
There was a problem hiding this comment.
Updated in 9f96c6b: it now mentions the Comments tab, and counting tab switches and opening comments.
| "https://www.nexusmods.com/skyrimspecialedition/mods/1?tab=posts", | ||
| ); | ||
| expect(propertiesOf("browse_mods_comments_opened")).toEqual([{ mod_uid: "1704-1" }]); | ||
| vi.unstubAllGlobals(); |
There was a problem hiding this comment.
nit: if the expect above fails, vi.unstubAllGlobals() never runs and the stubbed api leaks into later tests. An afterEach(() => vi.unstubAllGlobals()) would cover it. (Sibling tests do the same thing, so this is optional.)
There was a problem hiding this comment.
Added the afterEach in 9f96c6b and dropped the two trailing unstubAllGlobals calls it covers.
| vi.stubGlobal("api", { ...window.api, shell: { openUrl } }); | ||
| renderComponent(); | ||
|
|
||
| await userEvent.click(screen.getByRole("tab", { name: "Comments" })); |
There was a problem hiding this comment.
nit: docs/testing.md says to use a data-testid when several elements share a role, because t hands back the key in tests. The two tabs share role="tab", so the name is matching text. The existing Details lookups do the same, so this is optional.
There was a problem hiding this comment.
Done in 9f96c6b: the tabs have mod-details-tab-details and mod-details-tab-comments test ids, and View comments has mod-comments-website. The older Details lookups use them too.
…in ModDetails' doc what it counts now, unstub globals after each test, and find the tabs and View comments by test id (part of LAZ-1708)
…, as the updated design does (part of LAZ-1708)
Browse's mod details get a Comments tab next to Details. Vortex doesn't show comments yet, so the tab says they're coming and links to the mod's comments on the website. Design: Figma.
What changes
ModCommentsComingSoonshows "Mod comments are coming to Vortex soon", with a View comments button that opens the mod's Posts tab (nexusModCommentsUrl,…/mods/<id>?tab=posts). It reusesNoResults, as Browse's mods "coming soon" screen does, inside a card.browse_mods_details_tab_selected {mod_uid, tab, previous_tab}when the user switches tab, by click or the keys. Clicking the open tab sends nothing.browse_mods_comments_opened {mod_uid}from View comments.surface-translucent-lowand-mid), so they sit on the game art. This changes every secondary tab, not just Browse's.Tests
ModDetailschecks that View comments opens the comments page and is counted, and that each tab switch is counted once, with the tab it left.ModDetailstests found the scroll area bytabindex="-1", which the unselected tab now has too. They use a test id instead.pnpm run verifypasses (it excludes E2E). Not tried in the app yet.Part of LAZ-1708