da3c3d2b9d
Closes https://github.com/twentyhq/core-team-issues/issues/1560 If viewId is defined in a groupBy query, we want to apply all filters of the view to the query. This required to move a lot of code from twenty-front to twenty-shared to convert the filters as stored in the db into graphql filters, applying the right combinations between filters etc., which was previously only done in the FE. This PR does not handle any field filters, it will be done in a later pr
31 lines
822 B
TypeScript
31 lines
822 B
TypeScript
import { useTheme } from '@emotion/react';
|
|
import { useLingui } from '@lingui/react/macro';
|
|
import { CustomError } from 'twenty-shared/utils';
|
|
|
|
import { ConfigSource } from '~/generated/graphql';
|
|
|
|
export const useSourceContent = (source: ConfigSource) => {
|
|
const { t } = useLingui();
|
|
const theme = useTheme();
|
|
|
|
switch (source) {
|
|
case ConfigSource.DATABASE:
|
|
return {
|
|
text: t`Stored in database`,
|
|
color: theme.color.blue50,
|
|
};
|
|
case ConfigSource.ENVIRONMENT:
|
|
return {
|
|
text: t`Environment variable`,
|
|
color: theme.color.green50,
|
|
};
|
|
case ConfigSource.DEFAULT:
|
|
return {
|
|
text: t`Default value`,
|
|
color: theme.font.color.tertiary,
|
|
};
|
|
default:
|
|
throw new CustomError(`Unknown source: ${source}`, 'UNKNOWN_SOURCE');
|
|
}
|
|
};
|