Refactor/context and scopes (#1602)

* Put onImport in a context

* Refactored RecoilScopeContexts

* Refactored naming

* Fix tests

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Lucas Bordeau
2023-09-15 21:51:46 +02:00
committed by GitHub
parent d07474ece7
commit 0a7a0ac6cb
102 changed files with 639 additions and 552 deletions

View File

@ -13,6 +13,7 @@ import { TabList } from '@/ui/tab/components/TabList';
import { TopBar } from '@/ui/top-bar/TopBar';
import { RecoilScope } from '@/ui/utilities/recoil-scope/components/RecoilScope';
import { FilterDropdownButton } from '@/ui/view-bar/components/FilterDropdownButton';
import { ViewBarContext } from '@/ui/view-bar/contexts/ViewBarContext';
import { TasksEffect } from './TasksEffect';
@ -47,35 +48,41 @@ export function Tasks() {
return (
<PageContainer>
<RecoilScope SpecificContext={DropdownRecoilScopeContext}>
<RecoilScope SpecificContext={TasksRecoilScopeContext}>
<RecoilScope CustomRecoilScopeContext={DropdownRecoilScopeContext}>
<RecoilScope CustomRecoilScopeContext={TasksRecoilScopeContext}>
<TasksEffect />
<PageHeader title="Tasks" Icon={IconCheckbox}>
<PageAddTaskButton />
</PageHeader>
<PageBody>
<StyledTasksContainer>
<TopBar
leftComponent={
<StyledTabListContainer>
<TabList
context={TasksRecoilScopeContext}
tabs={TASK_TABS}
{/* TODO: we should refactor filters as a standalone module ? */}
<ViewBarContext.Provider
value={{
ViewBarRecoilScopeContext: TasksRecoilScopeContext,
}}
>
<StyledTasksContainer>
<TopBar
leftComponent={
<StyledTabListContainer>
<TabList
context={TasksRecoilScopeContext}
tabs={TASK_TABS}
/>
</StyledTabListContainer>
}
rightComponent={
<FilterDropdownButton
key="tasks-filter-dropdown-button"
hotkeyScope={{
scope: RelationPickerHotkeyScope.RelationPicker,
}}
/>
</StyledTabListContainer>
}
rightComponent={
<FilterDropdownButton
key="tasks-filter-dropdown-button"
context={TasksRecoilScopeContext}
hotkeyScope={{
scope: RelationPickerHotkeyScope.RelationPicker,
}}
/>
}
/>
<TaskGroups />
</StyledTasksContainer>
}
/>
<TaskGroups />
</StyledTasksContainer>
</ViewBarContext.Provider>
</PageBody>
</RecoilScope>
</RecoilScope>