Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
4rthem committed Sep 3, 2024
1 parent a7fcddf commit d8b8026
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion databox/client/src/components/Basket/BasketSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ type Props<Item extends AssetOrAssetContainer> = {
export default function BasketSwitcher<Item extends AssetOrAssetContainer>({
selectionContext,
}: Props<Item>) {
const {t} = useTranslation();
const current = useBasketStore(state => state.current);
const addToCurrent = useBasketStore(state => state.addToCurrent);
const loadingCurrent = useBasketStore(state => state.loadingCurrent);
const {openModal} = useModals();
const navigateToModal = useNavigateToModal();
const {t} = useTranslation();
const {selection, itemToAsset, setSelection} = useContext(selectionContext);
const hasSelection = selection.length > 0;

Expand Down
2 changes: 1 addition & 1 deletion databox/client/src/components/Basket/BasketsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ type Props = {
};

function BasketsPanel({selected}: Props) {
const {t} = useTranslation();
const baskets = useBasketStore(state => state.baskets);
const loading = useBasketStore(state => state.loading);
const loadMore = useBasketStore(state => state.loadMore);
const hasMore = useBasketStore(state => state.hasMore);
const load = useBasketStore(state => state.load);
const deleteBasket = useBasketStore(state => state.deleteBasket);
const {openModal} = useModals();
const {t} = useTranslation();
const navigateToModal = useNavigateToModal();

const [searchQuery, setSearchQuery] = React.useState<string>('');
Expand Down
2 changes: 1 addition & 1 deletion databox/client/src/components/Basket/CreateBasket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ type Props = {
} & StackedModalProps;

export default function CreateBasket({modalIndex, open, onCreate}: Props) {
const {closeModal} = useModals();
const {t} = useTranslation();
const {closeModal} = useModals();
const addBasket = useBasketStore(state => state.addBasket);

const usedFormSubmit = useFormSubmit<Basket>({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {ResultContext} from './ResultContext';
import {useTranslation} from 'react-i18next';
import {PropsWithChildren, useContext, useEffect, useState} from 'react';
import {ESDebug, GetAssetOptions, getAssets} from '../../../api/asset';
import {Asset} from '../../../types';
Expand Down Expand Up @@ -87,6 +88,7 @@ type Props = PropsWithChildren<{}>;

export default function ResultProvider({children}: Props) {
const searchContext = useContext(SearchContext)!;
const {t} = useTranslation();

const [state, setState] = useState<State>({
pages: [],
Expand All @@ -105,7 +107,7 @@ export default function ResultProvider({children}: Props) {
try {
const r = await search(
searchContext.query,
getResolvedSortBy(searchContext.sortBy),
getResolvedSortBy(searchContext.sortBy, t),
nextUrl,
searchContext.attrFilters,
{
Expand Down
6 changes: 3 additions & 3 deletions databox/client/src/components/Media/Search/SearchProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {FilterEntry, Filters, FilterType, SortBy} from './Filter';
import {BuiltInFilter, hashToQuery, queryToHash} from './search';
import useHash from '../../../lib/useHash';
import {useTranslation} from 'react-i18next';
import type {TFunction} from '@alchemy/i18n';

export function getResolvedSortBy(sortBy: SortBy[]): SortBy[] {
const {t} = useTranslation();
export function getResolvedSortBy(sortBy: SortBy[], t: TFunction): SortBy[] {
return sortBy.length > 0
? sortBy
: [
Expand Down Expand Up @@ -45,7 +45,7 @@ export default function SearchProvider({children}: PropsWithChildren<{}>) {
[inputQuery]
);

const resolvedSortBy = getResolvedSortBy(sortBy);
const resolvedSortBy = getResolvedSortBy(sortBy, t);

React.useEffect(() => {
setInputQuery(query);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function EditSortBy({onClose}: Props) {

const list = useMemo<TogglableSortBy[]>(() => {
const l: TogglableSortBy[] = [];
getResolvedSortBy(sortBy).forEach(s => {
getResolvedSortBy(sortBy, t).forEach(s => {
l.push({
...s,
id: s.a,
Expand Down

0 comments on commit d8b8026

Please sign in to comment.