forked from farhoodlabs/paperclip
Disable inbox nesting on mobile
This commit is contained in:
@@ -24,6 +24,7 @@ import {
|
|||||||
loadLastInboxTab,
|
loadLastInboxTab,
|
||||||
normalizeInboxIssueColumns,
|
normalizeInboxIssueColumns,
|
||||||
RECENT_ISSUES_LIMIT,
|
RECENT_ISSUES_LIMIT,
|
||||||
|
resolveInboxNestingEnabled,
|
||||||
resolveIssueWorkspaceName,
|
resolveIssueWorkspaceName,
|
||||||
resolveInboxSelectionIndex,
|
resolveInboxSelectionIndex,
|
||||||
saveInboxIssueColumns,
|
saveInboxIssueColumns,
|
||||||
@@ -520,6 +521,19 @@ describe("inbox helpers", () => {
|
|||||||
expect(loadLastInboxTab()).toBe("all");
|
expect(loadLastInboxTab()).toBe("all");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("keeps nesting enabled on desktop when the saved preference is on", () => {
|
||||||
|
expect(resolveInboxNestingEnabled(true, false)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("forces nesting off on mobile even when the saved preference is on", () => {
|
||||||
|
expect(resolveInboxNestingEnabled(true, true)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("keeps nesting off when the saved preference is off", () => {
|
||||||
|
expect(resolveInboxNestingEnabled(false, false)).toBe(false);
|
||||||
|
expect(resolveInboxNestingEnabled(false, true)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
it("defaults issue columns to the current inbox layout", () => {
|
it("defaults issue columns to the current inbox layout", () => {
|
||||||
expect(loadInboxIssueColumns()).toEqual(DEFAULT_INBOX_ISSUE_COLUMNS);
|
expect(loadInboxIssueColumns()).toEqual(DEFAULT_INBOX_ISSUE_COLUMNS);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -169,6 +169,10 @@ export function saveInboxNesting(enabled: boolean) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function resolveInboxNestingEnabled(preferenceEnabled: boolean, isMobile: boolean): boolean {
|
||||||
|
return preferenceEnabled && !isMobile;
|
||||||
|
}
|
||||||
|
|
||||||
export function loadLastInboxTab(): InboxTab {
|
export function loadLastInboxTab(): InboxTab {
|
||||||
try {
|
try {
|
||||||
const raw = localStorage.getItem(INBOX_LAST_TAB_KEY);
|
const raw = localStorage.getItem(INBOX_LAST_TAB_KEY);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import { projectsApi } from "../api/projects";
|
|||||||
import { useCompany } from "../context/CompanyContext";
|
import { useCompany } from "../context/CompanyContext";
|
||||||
import { useBreadcrumbs } from "../context/BreadcrumbContext";
|
import { useBreadcrumbs } from "../context/BreadcrumbContext";
|
||||||
import { useGeneralSettings } from "../context/GeneralSettingsContext";
|
import { useGeneralSettings } from "../context/GeneralSettingsContext";
|
||||||
|
import { useSidebar } from "../context/SidebarContext";
|
||||||
import { queryKeys } from "../lib/queryKeys";
|
import { queryKeys } from "../lib/queryKeys";
|
||||||
import {
|
import {
|
||||||
armIssueDetailInboxQuickArchive,
|
armIssueDetailInboxQuickArchive,
|
||||||
@@ -87,6 +88,7 @@ import {
|
|||||||
loadInboxIssueColumns,
|
loadInboxIssueColumns,
|
||||||
loadInboxNesting,
|
loadInboxNesting,
|
||||||
normalizeInboxIssueColumns,
|
normalizeInboxIssueColumns,
|
||||||
|
resolveInboxNestingEnabled,
|
||||||
resolveIssueWorkspaceName,
|
resolveIssueWorkspaceName,
|
||||||
resolveInboxSelectionIndex,
|
resolveInboxSelectionIndex,
|
||||||
saveInboxIssueColumns,
|
saveInboxIssueColumns,
|
||||||
@@ -579,6 +581,7 @@ function JoinRequestInboxRow({
|
|||||||
export function Inbox() {
|
export function Inbox() {
|
||||||
const { selectedCompanyId } = useCompany();
|
const { selectedCompanyId } = useCompany();
|
||||||
const { setBreadcrumbs } = useBreadcrumbs();
|
const { setBreadcrumbs } = useBreadcrumbs();
|
||||||
|
const { isMobile } = useSidebar();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@@ -911,9 +914,10 @@ export function Inbox() {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// --- Parent-child nesting for inbox issues ---
|
// --- Parent-child nesting for inbox issues ---
|
||||||
const [nestingEnabled, setNestingEnabled] = useState(() => loadInboxNesting());
|
const [nestingPreferenceEnabled, setNestingPreferenceEnabled] = useState(() => loadInboxNesting());
|
||||||
|
const nestingEnabled = resolveInboxNestingEnabled(nestingPreferenceEnabled, isMobile);
|
||||||
const toggleNesting = useCallback(() => {
|
const toggleNesting = useCallback(() => {
|
||||||
setNestingEnabled((prev) => {
|
setNestingPreferenceEnabled((prev) => {
|
||||||
const next = !prev;
|
const next = !prev;
|
||||||
saveInboxNesting(next);
|
saveInboxNesting(next);
|
||||||
return next;
|
return next;
|
||||||
|
|||||||
Reference in New Issue
Block a user