Skip to content

Commit

Permalink
fix: sorting by modified doesn't work (close AlistGo/alist#1776)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Sep 23, 2022
1 parent 82b8c72 commit 786dbb4
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions src/pages/home/folder/List.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { HStack, VStack, Text, Checkbox } from "@hope-ui/solid";
import { batch, createEffect, createSignal, For, Show } from "solid-js";
import { useT } from "~/hooks";
import { HStack, VStack, Text, Checkbox } from "@hope-ui/solid"
import { batch, createEffect, createSignal, For, Show } from "solid-js"
import { useT } from "~/hooks"
import {
allChecked,
checkboxOpen,
isIndeterminate,
objStore,
selectAll,
sortObjs,
} from "~/store";
import { OrderBy } from "~/store";
import { Col, cols, ListItem } from "./ListItem";
} from "~/store"
import { OrderBy } from "~/store"
import { Col, cols, ListItem } from "./ListItem"

const ListLayout = () => {
const t = useT();
const [orderBy, setOrderBy] = createSignal<OrderBy>();
const [reverse, setReverse] = createSignal(false);
const t = useT()
const [orderBy, setOrderBy] = createSignal<OrderBy>()
const [reverse, setReverse] = createSignal(false)
createEffect(() => {
if (orderBy()) {
sortObjs(orderBy()!, reverse());
sortObjs(orderBy()!, reverse())
}
});
})
const itemProps = (col: Col) => {
return {
fontWeight: "bold",
Expand All @@ -30,16 +30,16 @@ const ListLayout = () => {
cursor: "pointer",
onClick: () => {
if (col.name === orderBy()) {
setReverse(!reverse());
setReverse(!reverse())
} else {
batch(() => {
setOrderBy(col.name as OrderBy);
setReverse(false);
});
setOrderBy(col.name as OrderBy)
setReverse(false)
})
}
},
};
};
}
}
return (
<VStack class="list" w="$full" spacing="$1">
<HStack class="title" w="$full" p="$2">
Expand All @@ -49,7 +49,7 @@ const ListLayout = () => {
checked={allChecked()}
indeterminate={isIndeterminate()}
onChange={(e: any) => {
selectAll(e.target.checked as boolean);
selectAll(e.target.checked as boolean)
}}
/>
</Show>
Expand All @@ -60,19 +60,19 @@ const ListLayout = () => {
</Text>
<Text
w={cols[2].w}
{...itemProps(cols[1])}
{...itemProps(cols[2])}
display={{ "@initial": "none", "@md": "inline" }}
>
{t(`home.obj.${cols[2].name}`)}
</Text>
</HStack>
<For each={objStore.objs}>
{(obj, i) => {
return <ListItem obj={obj} index={i()} />;
return <ListItem obj={obj} index={i()} />
}}
</For>
</VStack>
);
};
)
}

export default ListLayout;
export default ListLayout

0 comments on commit 786dbb4

Please sign in to comment.