Skip to content

Commit f06b59f

Browse files
baxennpub1k766u8wq088nkr9vy94uqlh9kmw5956g593a7xk7cks7frhgctmsr00p27
andauthored
feat(desktop): graduate community rail (#1995)
Signed-off-by: npub1k766u8wq088nkr9vy94uqlh9kmw5956g593a7xk7cks7frhgctmsr00p27 <b7b5ae1dc079cf3b0cac216bc07ee5b6dd42d348a163df1adec5a1e48ee8c2f7@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1k766u8wq088nkr9vy94uqlh9kmw5956g593a7xk7cks7frhgctmsr00p27 <b7b5ae1dc079cf3b0cac216bc07ee5b6dd42d348a163df1adec5a1e48ee8c2f7@sprout-oss.stage.blox.sqprod.co>
1 parent 2494926 commit f06b59f

4 files changed

Lines changed: 18 additions & 24 deletions

File tree

‎desktop/src/app/AppShell.tsx‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ import { useCommunities } from "@/features/communities/useCommunities";
7575
import { useAddCommunityDialogState } from "@/features/communities/addCommunityPrefill";
7676
import { useApplyTemplate } from "@/features/channel-templates/useApplyTemplate";
7777
import { relayClient } from "@/shared/api/relayClient";
78-
import { useFeatureEnabled } from "@/shared/features";
7978
import { useIdentityQuery } from "@/shared/api/hooks";
8079
import { useRelayAutoHeal } from "@/shared/api/useRelayAutoHeal";
8180
import { useDeferredStartup } from "@/shared/hooks/useDeferredStartup";
@@ -103,7 +102,7 @@ export function AppShell() {
103102
useWebviewScrollBoundaryLock();
104103

105104
const communitiesHook = useCommunities();
106-
const communityRailEnabled = useFeatureEnabled("workspaceRail");
105+
const hasCommunityRail = communitiesHook.communities.length > 1;
107106
const addCommunityDialog = useAddCommunityDialogState();
108107
const [isChannelManagementOpen, setIsChannelManagementOpen] =
109108
React.useState(false);
@@ -762,7 +761,7 @@ export function AppShell() {
762761
isHuddleDrawerOpen && "buzz-huddle-app-surface-open",
763762
)}
764763
>
765-
{communityRailEnabled ? (
764+
{hasCommunityRail ? (
766765
<CommunityRail
767766
activeCommunityId={
768767
communitiesHook.activeCommunity?.id ?? null
@@ -779,10 +778,7 @@ export function AppShell() {
779778
<AppTopChrome
780779
canGoBack={canGoBack}
781780
canGoForward={canGoForward}
782-
hasCommunityRail={
783-
communityRailEnabled &&
784-
communitiesHook.communities.length > 1
785-
}
781+
hasCommunityRail={hasCommunityRail}
786782
onGoBack={goBack}
787783
onGoForward={goForward}
788784
/>
@@ -935,10 +931,7 @@ export function AppShell() {
935931
<RelayConnectionOverlay
936932
card={relayConnectionCard}
937933
errorMessage={channelsErrorMessage}
938-
hasCommunityRail={
939-
communityRailEnabled &&
940-
communitiesHook.communities.length > 1
941-
}
934+
hasCommunityRail={hasCommunityRail}
942935
isHuddleDrawerOpen={isHuddleDrawerOpen}
943936
/>
944937
</div>

‎desktop/src/shared/features/resolveEnabled.test.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ describe("resolveEnabled (preview-only)", () => {
1313
});
1414

1515
it("uses an enabled manifest default when no override exists", () => {
16-
assert.equal(resolveEnabled("workspaceRail", {}, true), true);
16+
assert.equal(resolveEnabled("defaultOnFeature", {}, true), true);
1717
});
1818

1919
it("lets an explicit opt-out override an enabled default", () => {
2020
assert.equal(
21-
resolveEnabled("workspaceRail", { workspaceRail: false }, true),
21+
resolveEnabled("defaultOnFeature", { defaultOnFeature: false }, true),
2222
false,
2323
);
2424
});

‎desktop/tests/e2e/community-rail.spec.ts‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { expect, test } from "@playwright/test";
22

33
import { installMockBridge } from "../helpers/bridge";
4+
import { FEATURE_OVERRIDES_STORAGE_KEY } from "../helpers/features";
45

56
const RELAY_URL = "ws://localhost:3000";
67

@@ -32,11 +33,20 @@ async function seedCommunities(
3233
}
3334

3435
test.describe("community rail", () => {
35-
test("shows a button per community and highlights the active one", async ({
36+
test("shows the rail with multiple communities despite a stale opt-out", async ({
3637
page,
3738
}) => {
38-
await installMockBridge(page, undefined, { skipCommunitySeed: true });
39+
await installMockBridge(page, undefined, {
40+
seedPreviewFeatures: false,
41+
skipCommunitySeed: true,
42+
});
3943
await seedCommunities(page, [COMMUNITY_A, COMMUNITY_B], COMMUNITY_A.id);
44+
await page.addInitScript((overridesKey) => {
45+
window.localStorage.setItem(
46+
overridesKey,
47+
JSON.stringify({ workspaceRail: false }),
48+
);
49+
}, FEATURE_OVERRIDES_STORAGE_KEY);
4050
await page.goto("/");
4151

4252
const rail = page.getByTestId("community-rail");

‎preview-features.json‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@
2525
"desktop"
2626
]
2727
},
28-
{
29-
"id": "workspaceRail",
30-
"name": "Community Rail",
31-
"defaultEnabled": true,
32-
"description": "Far-left rail for switching communities with cross-community unread indicators",
33-
"platforms": [
34-
"desktop"
35-
]
36-
},
3728
{
3829
"id": "forum",
3930
"name": "Forum Channels",

0 commit comments

Comments
 (0)