Explorar o código

refactor(app): remove unused UI helpers (#40686)

Kit Langton hai 1 semana
pai
achega
f3912a2a8a

+ 0 - 5
packages/app/src/context/command.tsx

@@ -248,11 +248,6 @@ export function formatKeybind(config: string, t?: (key: KeyLabel) => string): st
   return IS_MAC ? parts.join("") : parts.join("+")
 }
 
-// KeybindV2 takes an array instead of a string
-export function formatKeybindKeys(config: string, t?: (key: KeyLabel) => string): string[] {
-  return formatKeybindParts(config, t)
-}
-
 function isEditableTarget(target: EventTarget | null) {
   if (!(target instanceof HTMLElement)) return false
   if (target.isContentEditable) return true

+ 0 - 7
packages/app/src/context/file.tsx

@@ -286,13 +286,6 @@ export const { use: useFile, provider: FileProvider } = createSimpleContext({
         children: tree.children,
         expand: tree.expandDir,
         collapse: tree.collapseDir,
-        toggle(input: string) {
-          if (tree.dirState(input)?.expanded) {
-            tree.collapseDir(input)
-            return
-          }
-          tree.expandDir(input)
-        },
       },
       get,
       load,

+ 0 - 12
packages/app/src/context/global-sync/utils.ts

@@ -153,18 +153,6 @@ export function normalizeProviderList(
   }
 }
 
-export function sanitizeProject(project: Project) {
-  if (!project.icon?.url && !project.icon?.override) return project
-  return {
-    ...project,
-    icon: {
-      ...project.icon,
-      url: undefined,
-      override: undefined,
-    },
-  }
-}
-
 export function normalizeProjectInfo(project: Project | CurrentProject): Project {
   return {
     ...project,

+ 0 - 30
packages/app/src/context/layout.tsx

@@ -753,9 +753,6 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
       },
       mobileSidebar: {
         opened: createMemo(() => store.mobileSidebar?.opened ?? false),
-        show() {
-          setStore("mobileSidebar", "opened", true)
-        },
         hide() {
           setStore("mobileSidebar", "opened", false)
         },
@@ -961,33 +958,6 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
               if (current.reviewOpen.includes(path)) return
               setStore("sessionView", session, "reviewOpen", current.reviewOpen.length, path)
             },
-            closePath(path: string) {
-              const session = key()
-              const current = store.sessionView[session]?.reviewOpen
-              if (!current) return
-
-              const index = current.indexOf(path)
-              if (index === -1) return
-              setStore(
-                "sessionView",
-                session,
-                "reviewOpen",
-                produce((draft) => {
-                  if (!draft) return
-                  draft.splice(index, 1)
-                }),
-              )
-            },
-            togglePath(path: string) {
-              const session = key()
-              const current = store.sessionView[session]?.reviewOpen
-              if (!current || !current.includes(path)) {
-                this.openPath(path)
-                return
-              }
-
-              this.closePath(path)
-            },
           },
         }
       },

+ 0 - 2
packages/app/src/pages/session/helpers.ts

@@ -22,8 +22,6 @@ type TabsInput = {
   fileBrowser?: Accessor<boolean>
 }
 
-export const getSessionKey = (dir: string | undefined, id: string | undefined) => `${dir ?? ""}${id ? `/${id}` : ""}`
-
 export function shouldShowFileTree(input: { visible: boolean; opened: boolean }) {
   return input.opened && input.visible
 }