Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
svelte: Fix issues reported by svelte-check (#59373)
Browse files Browse the repository at this point in the history
Fixes TS/format issues introduced by recent commits.
  • Loading branch information
fkling authored Jan 8, 2024
1 parent 735d000 commit 7bd99ec
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
4 changes: 0 additions & 4 deletions client/web-sveltekit/src/lib/fileIcons.ts

This file was deleted.

23 changes: 12 additions & 11 deletions client/web-sveltekit/src/lib/search/utils.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import type { ContentMatch, MatchGroup, ChunkMatch, LineMatch, Filter } from '$lib/shared'

export interface SidebarFilter {
value: string
label: string
count?: number
limitHit?: boolean
kind: 'file' | 'repo' | 'lang' | 'utility'
export interface SidebarFilter extends Filter {
runImmediately?: boolean
}

Expand All @@ -21,21 +16,27 @@ export function resultToMatchGroups(result: ContentMatch): MatchGroup[] {
return result.chunkMatches?.map(chunkToMatchGroup) || result.lineMatches?.map(lineToMatchGroup) || []
}

interface FilterGroups {
repo: Filter[]
file: Filter[]
lang: Filter[]
}
type FilterGroups = Record<Filter['kind'], Filter[]>

export function groupFilters(filters: Filter[] | null | undefined): FilterGroups {
const groupedFilters: FilterGroups = {
file: [],
repo: [],
lang: [],
utility: [],
author: [],
select: [],
after: [],
before: [],
}
if (filters) {
for (const filter of filters) {
switch (filter.kind) {
case 'after':
case 'before':
case 'author':
case 'utility':
case 'select':
case 'repo':
case 'file':
case 'lang': {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<svelte:options immutable />

<script lang="ts">
import {mdiFileCodeOutline, mdiFolderArrowUpOutline, mdiFolderOpenOutline, mdiFolderOutline} from '@mdi/js'
import { mdiFileCodeOutline, mdiFolderArrowUpOutline, mdiFolderOpenOutline, mdiFolderOutline } from '@mdi/js'
import { onMount } from 'svelte'
import { afterNavigate, goto } from '$app/navigation'
import {getFileIconInfo} from '$lib/wildcard'
import { getFileIconInfo } from '$lib/wildcard'
import Icon from '$lib/Icon.svelte'
import { type FileTreeProvider, NODE_LIMIT, type FileTreeNodeValue, type TreeEntryFields } from '$lib/repo/api/tree'
import { getSidebarFileTreeStateForRepo } from '$lib/repo/stores'
Expand Down Expand Up @@ -126,9 +126,11 @@
{#if entry.isDirectory}
<Icon svgPath={getDirectoryIconPath(entry, expanded)} inline />
{:else}
{@const icon =
(entry.__typename === 'GitBlob' && getFileIconInfo(entry.name, entry.languages.at(0) ?? '')?.svg) ||
{path: mdiFileCodeOutline, color: 'var(--gray-05)'}}
{@const icon = (entry.__typename === 'GitBlob' &&
getFileIconInfo(entry.name, entry.languages.at(0) ?? '')?.svg) || {
path: mdiFileCodeOutline,
color: 'var(--gray-05)',
}}
<Icon svgPath={icon.path} inline --color={icon.color} />
{/if}
{isRoot ? '..' : entry.name}
Expand Down

0 comments on commit 7bd99ec

Please sign in to comment.