Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/mobile/src/features/inbox/components/FilterSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const SOURCE_PRODUCT_OPTIONS: { value: SourceProduct; label: string }[] = [
{ value: "linear", label: "Linear" },
{ value: "zendesk", label: "Zendesk" },
{ value: "conversations", label: "Conversations" },
{ value: "signals_scout", label: "Scout" },
];

function SectionHeader({ title }: { title: string }) {
Expand Down
9 changes: 9 additions & 0 deletions apps/mobile/src/features/inbox/components/SignalCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ChatCircle,
CheckCircle,
Code,
Compass,
GithubLogo,
LinkSimple,
Question,
Expand Down Expand Up @@ -46,6 +47,12 @@ function sourceLine(signal: Signal): string {
return "GitHub · Issue";
if (source_product === "linear" && source_type === "issue")
return "Linear · Issue";
if (
source_product === "signals_scout" &&
source_type === "cross_source_issue"
)
return "Scout · Cross-source issue";
if (source_product === "signals_scout") return "Scout";
const product = source_product.replace(/_/g, " ");
const type = source_type.replace(/_/g, " ");
return `${product} · ${type}`;
Expand Down Expand Up @@ -73,6 +80,8 @@ function SourceIcon({
return <ChatCircle size={size} color={color} />;
case "linear":
return <LinkSimple size={size} color={color} />;
case "signals_scout":
return <Compass size={size} color={color} />;
default:
return <WarningCircle size={size} color={color} />;
}
Expand Down
39 changes: 34 additions & 5 deletions apps/mobile/src/features/inbox/stores/inboxFilterStore.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,43 @@
import { beforeEach, describe, expect, it } from "vitest";
import { beforeEach, describe, expect, it, vi } from "vitest";

import { useInboxFilterStore } from "./inboxFilterStore";
vi.mock("@react-native-async-storage/async-storage", () => ({
default: {
getItem: vi.fn(),
setItem: vi.fn(),
removeItem: vi.fn(),
},
}));

const INITIAL_STATE = useInboxFilterStore.getState();
import { type SourceProduct, useInboxFilterStore } from "./inboxFilterStore";

describe("inboxFilterStore", () => {
beforeEach(() => {
useInboxFilterStore.getState().resetFilters();
});

it.each<SourceProduct>(["signals_scout", "error_tracking", "github"])(
"toggles %s in and out of the source filter",
(source) => {
const { toggleSourceProduct } = useInboxFilterStore.getState();

beforeEach(() => {
useInboxFilterStore.setState(INITIAL_STATE, true);
toggleSourceProduct(source);
expect(useInboxFilterStore.getState().sourceProductFilter).toEqual([
source,
]);

toggleSourceProduct(source);
expect(useInboxFilterStore.getState().sourceProductFilter).toEqual([]);
},
);
});

const INITIAL_STATE = useInboxFilterStore.getState();

describe("inboxFilterStore priority filter", () => {
beforeEach(() => {
useInboxFilterStore.setState(INITIAL_STATE, true);
});

it("starts empty (no priority filter)", () => {
expect(useInboxFilterStore.getState().priorityFilter).toEqual([]);
});
Expand Down
3 changes: 2 additions & 1 deletion apps/mobile/src/features/inbox/stores/inboxFilterStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export type SourceProduct =
| "github"
| "linear"
| "zendesk"
| "conversations";
| "conversations"
| "signals_scout";

export const DEFAULT_STATUS_FILTER: SignalReportStatus[] = [
"ready",
Expand Down
Loading