mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
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>
This commit is contained in:
co-authored by
npub1k766u8wq088nkr9vy94uqlh9kmw5956g593a7xk7cks7frhgctmsr00p27
parent
249492685c
commit
f06b59ff13
@@ -75,7 +75,6 @@ import { useCommunities } from "@/features/communities/useCommunities";
|
||||
import { useAddCommunityDialogState } from "@/features/communities/addCommunityPrefill";
|
||||
import { useApplyTemplate } from "@/features/channel-templates/useApplyTemplate";
|
||||
import { relayClient } from "@/shared/api/relayClient";
|
||||
import { useFeatureEnabled } from "@/shared/features";
|
||||
import { useIdentityQuery } from "@/shared/api/hooks";
|
||||
import { useRelayAutoHeal } from "@/shared/api/useRelayAutoHeal";
|
||||
import { useDeferredStartup } from "@/shared/hooks/useDeferredStartup";
|
||||
@@ -103,7 +102,7 @@ export function AppShell() {
|
||||
useWebviewScrollBoundaryLock();
|
||||
|
||||
const communitiesHook = useCommunities();
|
||||
const communityRailEnabled = useFeatureEnabled("workspaceRail");
|
||||
const hasCommunityRail = communitiesHook.communities.length > 1;
|
||||
const addCommunityDialog = useAddCommunityDialogState();
|
||||
const [isChannelManagementOpen, setIsChannelManagementOpen] =
|
||||
React.useState(false);
|
||||
@@ -762,7 +761,7 @@ export function AppShell() {
|
||||
isHuddleDrawerOpen && "buzz-huddle-app-surface-open",
|
||||
)}
|
||||
>
|
||||
{communityRailEnabled ? (
|
||||
{hasCommunityRail ? (
|
||||
<CommunityRail
|
||||
activeCommunityId={
|
||||
communitiesHook.activeCommunity?.id ?? null
|
||||
@@ -779,10 +778,7 @@ export function AppShell() {
|
||||
<AppTopChrome
|
||||
canGoBack={canGoBack}
|
||||
canGoForward={canGoForward}
|
||||
hasCommunityRail={
|
||||
communityRailEnabled &&
|
||||
communitiesHook.communities.length > 1
|
||||
}
|
||||
hasCommunityRail={hasCommunityRail}
|
||||
onGoBack={goBack}
|
||||
onGoForward={goForward}
|
||||
/>
|
||||
@@ -935,10 +931,7 @@ export function AppShell() {
|
||||
<RelayConnectionOverlay
|
||||
card={relayConnectionCard}
|
||||
errorMessage={channelsErrorMessage}
|
||||
hasCommunityRail={
|
||||
communityRailEnabled &&
|
||||
communitiesHook.communities.length > 1
|
||||
}
|
||||
hasCommunityRail={hasCommunityRail}
|
||||
isHuddleDrawerOpen={isHuddleDrawerOpen}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -13,12 +13,12 @@ describe("resolveEnabled (preview-only)", () => {
|
||||
});
|
||||
|
||||
it("uses an enabled manifest default when no override exists", () => {
|
||||
assert.equal(resolveEnabled("workspaceRail", {}, true), true);
|
||||
assert.equal(resolveEnabled("defaultOnFeature", {}, true), true);
|
||||
});
|
||||
|
||||
it("lets an explicit opt-out override an enabled default", () => {
|
||||
assert.equal(
|
||||
resolveEnabled("workspaceRail", { workspaceRail: false }, true),
|
||||
resolveEnabled("defaultOnFeature", { defaultOnFeature: false }, true),
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
import { installMockBridge } from "../helpers/bridge";
|
||||
import { FEATURE_OVERRIDES_STORAGE_KEY } from "../helpers/features";
|
||||
|
||||
const RELAY_URL = "ws://localhost:3000";
|
||||
|
||||
@@ -32,11 +33,20 @@ async function seedCommunities(
|
||||
}
|
||||
|
||||
test.describe("community rail", () => {
|
||||
test("shows a button per community and highlights the active one", async ({
|
||||
test("shows the rail with multiple communities despite a stale opt-out", async ({
|
||||
page,
|
||||
}) => {
|
||||
await installMockBridge(page, undefined, { skipCommunitySeed: true });
|
||||
await installMockBridge(page, undefined, {
|
||||
seedPreviewFeatures: false,
|
||||
skipCommunitySeed: true,
|
||||
});
|
||||
await seedCommunities(page, [COMMUNITY_A, COMMUNITY_B], COMMUNITY_A.id);
|
||||
await page.addInitScript((overridesKey) => {
|
||||
window.localStorage.setItem(
|
||||
overridesKey,
|
||||
JSON.stringify({ workspaceRail: false }),
|
||||
);
|
||||
}, FEATURE_OVERRIDES_STORAGE_KEY);
|
||||
await page.goto("/");
|
||||
|
||||
const rail = page.getByTestId("community-rail");
|
||||
|
||||
@@ -25,15 +25,6 @@
|
||||
"desktop"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "workspaceRail",
|
||||
"name": "Community Rail",
|
||||
"defaultEnabled": true,
|
||||
"description": "Far-left rail for switching communities with cross-community unread indicators",
|
||||
"platforms": [
|
||||
"desktop"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "forum",
|
||||
"name": "Forum Channels",
|
||||
|
||||
Reference in New Issue
Block a user