2422 refactor scope components to improve dev experience (#2736)

* move scope inside record table

* fix imports

* update mock

* recordTable scope done

* RecordTable done

* fix board

* fix typo

* wip

* filter is working

* sort is working

* Tasks working

* Fix according to PR

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
bosiraphael
2023-11-28 18:24:18 +01:00
committed by GitHub
parent 9d3e000055
commit ade41c916d
60 changed files with 651 additions and 529 deletions
@@ -23,7 +23,7 @@ export const useViewFilters = (viewScopeId: string) => {
const apolloClient = useApolloClient();
const { currentViewFiltersState } = useViewScopedStates({
customViewScopeId: viewScopeId,
viewScopeId: viewScopeId,
});
const persistViewFilters = useRecoilCallback(
@@ -8,12 +8,12 @@ import { ViewScopeInternalContext } from '../../scopes/scope-internal-context/Vi
import { currentViewIdScopedState } from '../../states/currentViewIdScopedState';
import { getViewScopedStates } from '../../utils/internal/getViewScopedStates';
export const useViewScopedStates = (args?: { customViewScopeId?: string }) => {
const { customViewScopeId } = args ?? {};
export const useViewScopedStates = (args?: { viewScopeId?: string }) => {
const { viewScopeId } = args ?? {};
const scopeId = useAvailableScopeIdOrThrow(
ViewScopeInternalContext,
customViewScopeId,
viewScopeId,
);
// View
@@ -22,7 +22,7 @@ export const useViewSorts = (viewScopeId: string) => {
const apolloClient = useApolloClient();
const { currentViewSortsState } = useViewScopedStates({
customViewScopeId: viewScopeId,
viewScopeId: viewScopeId,
});
const persistViewSorts = useRecoilCallback(
@@ -25,13 +25,13 @@ import { useViewScopedStates } from './internal/useViewScopedStates';
import { useViewSorts } from './internal/useViewSorts';
type UseViewProps = {
viewScopeId?: string;
viewBarId?: string;
};
export const useView = (props?: UseViewProps) => {
export const useViewBar = (props?: UseViewProps) => {
const scopeId = useAvailableScopeIdOrThrow(
ViewScopeInternalContext,
props?.viewScopeId,
props?.viewBarId,
);
const {
@@ -46,7 +46,7 @@ export const useView = (props?: UseViewProps) => {
viewObjectMetadataIdState,
viewTypeState,
} = useViewScopedStates({
customViewScopeId: scopeId,
viewScopeId: scopeId,
});
const { persistViewSorts, upsertViewSort, removeViewSort } =