Moved Select Options to External Files (#11400)
This is a minor rework of PR #10738. I noticed an inconsistency with how Select options are passed as props. Many files use constants stored in external files to pass options props to Select objects. This allows for code reusability. Some files are not passing options in this format. I modified more files so that they use this method of passing options props. I made changes to: - WorkerQueueMetricsSection.tsx - SettingsDataModelFieldBooleanForm.tsx - SettingsDataModelFieldTextForm.tsx - SettingsDataModelFieldNumberForm.tsx - PlaygroundSetupForm.tsx - ViewPickerContentCreateMode.tsx I also noticed that some of these files were incorrectly using useLingui(), so I fixed the import and usage where needed. --------- Co-authored-by: Beau Smith <bsmith26@iastate.edu> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
0
packages/twenty-docker/scripts/install.sh
Executable file → Normal file
0
packages/twenty-docker/scripts/install.sh
Executable file → Normal file
0
packages/twenty-docker/twenty/entrypoint.sh
Executable file → Normal file
0
packages/twenty-docker/twenty/entrypoint.sh
Executable file → Normal file
0
packages/twenty-front/scripts/inject-runtime-env.sh
Executable file → Normal file
0
packages/twenty-front/scripts/inject-runtime-env.sh
Executable file → Normal file
@ -1,5 +1,5 @@
|
|||||||
import { Decorator, Meta, StoryObj } from '@storybook/react';
|
import { Decorator, Meta, StoryObj } from '@storybook/react';
|
||||||
import { expect, fn, userEvent, waitFor } from '@storybook/test';
|
import { expect, fn, userEvent, waitFor, within } from '@storybook/test';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
|
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
|
||||||
@ -143,9 +143,12 @@ type Story = StoryObj<typeof AddressInputWithContext>;
|
|||||||
export const Default: Story = {};
|
export const Default: Story = {};
|
||||||
|
|
||||||
export const Enter: Story = {
|
export const Enter: Story = {
|
||||||
play: async () => {
|
play: async ({ canvasElement }) => {
|
||||||
|
const canvas = within(canvasElement);
|
||||||
|
|
||||||
expect(enterJestFn).toHaveBeenCalledTimes(0);
|
expect(enterJestFn).toHaveBeenCalledTimes(0);
|
||||||
|
|
||||||
|
await canvas.findByText('Address 1');
|
||||||
await userEvent.keyboard('{enter}');
|
await userEvent.keyboard('{enter}');
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
|
|||||||
@ -137,8 +137,12 @@ type Story = StoryObj<typeof NumberFieldInputWithContext>;
|
|||||||
export const Default: Story = {};
|
export const Default: Story = {};
|
||||||
|
|
||||||
export const Enter: Story = {
|
export const Enter: Story = {
|
||||||
play: async () => {
|
play: async ({ canvasElement }) => {
|
||||||
|
const canvas = within(canvasElement);
|
||||||
|
|
||||||
expect(enterJestFn).toHaveBeenCalledTimes(0);
|
expect(enterJestFn).toHaveBeenCalledTimes(0);
|
||||||
|
|
||||||
|
await canvas.findByPlaceholderText('Enter number');
|
||||||
await userEvent.keyboard('{enter}');
|
await userEvent.keyboard('{enter}');
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
@ -148,9 +152,12 @@ export const Enter: Story = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const Escape: Story = {
|
export const Escape: Story = {
|
||||||
play: async () => {
|
play: async ({ canvasElement }) => {
|
||||||
|
const canvas = within(canvasElement);
|
||||||
|
|
||||||
expect(escapeJestfn).toHaveBeenCalledTimes(0);
|
expect(escapeJestfn).toHaveBeenCalledTimes(0);
|
||||||
|
|
||||||
|
await canvas.findByPlaceholderText('Enter number');
|
||||||
await userEvent.keyboard('{esc}');
|
await userEvent.keyboard('{esc}');
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
@ -167,6 +174,7 @@ export const ClickOutside: Story = {
|
|||||||
|
|
||||||
const emptyDiv = canvas.getByTestId('data-field-input-click-outside-div');
|
const emptyDiv = canvas.getByTestId('data-field-input-click-outside-div');
|
||||||
|
|
||||||
|
await canvas.findByPlaceholderText('Enter number');
|
||||||
await userEvent.click(emptyDiv);
|
await userEvent.click(emptyDiv);
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
@ -176,9 +184,12 @@ export const ClickOutside: Story = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const Tab: Story = {
|
export const Tab: Story = {
|
||||||
play: async () => {
|
play: async ({ canvasElement }) => {
|
||||||
|
const canvas = within(canvasElement);
|
||||||
|
|
||||||
expect(tabJestFn).toHaveBeenCalledTimes(0);
|
expect(tabJestFn).toHaveBeenCalledTimes(0);
|
||||||
|
|
||||||
|
await canvas.findByPlaceholderText('Enter number');
|
||||||
await userEvent.keyboard('{tab}');
|
await userEvent.keyboard('{tab}');
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
@ -188,9 +199,12 @@ export const Tab: Story = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const ShiftTab: Story = {
|
export const ShiftTab: Story = {
|
||||||
play: async () => {
|
play: async ({ canvasElement }) => {
|
||||||
|
const canvas = within(canvasElement);
|
||||||
|
|
||||||
expect(shiftTabJestFn).toHaveBeenCalledTimes(0);
|
expect(shiftTabJestFn).toHaveBeenCalledTimes(0);
|
||||||
|
|
||||||
|
await canvas.findByPlaceholderText('Enter number');
|
||||||
await userEvent.keyboard('{shift>}{tab}');
|
await userEvent.keyboard('{shift>}{tab}');
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
|
|||||||
@ -108,9 +108,11 @@ type Story = StoryObj<typeof RichTextFieldInputWithContext>;
|
|||||||
export const Default: Story = {};
|
export const Default: Story = {};
|
||||||
|
|
||||||
export const Escape: Story = {
|
export const Escape: Story = {
|
||||||
play: async () => {
|
play: async ({ canvasElement }) => {
|
||||||
|
const canvas = within(canvasElement);
|
||||||
expect(escapeJestFn).toHaveBeenCalledTimes(0);
|
expect(escapeJestFn).toHaveBeenCalledTimes(0);
|
||||||
|
|
||||||
|
await canvas.findByTestId('click-outside-element');
|
||||||
await userEvent.keyboard('{esc}');
|
await userEvent.keyboard('{esc}');
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import { FieldMetadataType } from '~/generated/graphql';
|
|||||||
import { StorybookFieldInputDropdownFocusIdSetterEffect } from '~/testing/components/StorybookFieldInputDropdownFocusIdSetterEffect';
|
import { StorybookFieldInputDropdownFocusIdSetterEffect } from '~/testing/components/StorybookFieldInputDropdownFocusIdSetterEffect';
|
||||||
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
|
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
|
||||||
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
|
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
|
||||||
import { sleep } from '~/utils/sleep';
|
|
||||||
import { useTextField } from '../../../hooks/useTextField';
|
import { useTextField } from '../../../hooks/useTextField';
|
||||||
import { TextFieldInput, TextFieldInputProps } from '../TextFieldInput';
|
import { TextFieldInput, TextFieldInputProps } from '../TextFieldInput';
|
||||||
const TextFieldValueSetterEffect = ({ value }: { value: string }) => {
|
const TextFieldValueSetterEffect = ({ value }: { value: string }) => {
|
||||||
@ -61,6 +60,7 @@ const TextFieldInputWithContext = ({
|
|||||||
metadata: {
|
metadata: {
|
||||||
fieldName: 'text',
|
fieldName: 'text',
|
||||||
objectMetadataNameSingular: 'person',
|
objectMetadataNameSingular: 'person',
|
||||||
|
placeHolder: 'Enter text',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
isLabelIdentifier: false,
|
isLabelIdentifier: false,
|
||||||
@ -130,10 +130,12 @@ type Story = StoryObj<typeof TextFieldInputWithContext>;
|
|||||||
export const Default: Story = {};
|
export const Default: Story = {};
|
||||||
|
|
||||||
export const Enter: Story = {
|
export const Enter: Story = {
|
||||||
play: async () => {
|
play: async ({ canvasElement }) => {
|
||||||
expect(enterJestFn).toHaveBeenCalledTimes(0);
|
const canvas = within(canvasElement);
|
||||||
await sleep(100);
|
|
||||||
|
|
||||||
|
expect(enterJestFn).toHaveBeenCalledTimes(0);
|
||||||
|
|
||||||
|
await canvas.findByPlaceholderText('Enter text');
|
||||||
await userEvent.keyboard('{enter}');
|
await userEvent.keyboard('{enter}');
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
@ -143,10 +145,12 @@ export const Enter: Story = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const Escape: Story = {
|
export const Escape: Story = {
|
||||||
play: async () => {
|
play: async ({ canvasElement }) => {
|
||||||
expect(escapeJestfn).toHaveBeenCalledTimes(0);
|
const canvas = within(canvasElement);
|
||||||
await sleep(100);
|
|
||||||
|
|
||||||
|
expect(escapeJestfn).toHaveBeenCalledTimes(0);
|
||||||
|
|
||||||
|
await canvas.findByPlaceholderText('Enter text');
|
||||||
await userEvent.keyboard('{esc}');
|
await userEvent.keyboard('{esc}');
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
@ -158,7 +162,7 @@ export const Escape: Story = {
|
|||||||
export const ClickOutside: Story = {
|
export const ClickOutside: Story = {
|
||||||
play: async ({ canvasElement }) => {
|
play: async ({ canvasElement }) => {
|
||||||
const canvas = within(canvasElement);
|
const canvas = within(canvasElement);
|
||||||
await sleep(100);
|
await canvas.findByPlaceholderText('Enter text');
|
||||||
|
|
||||||
expect(clickOutsideJestFn).toHaveBeenCalledTimes(0);
|
expect(clickOutsideJestFn).toHaveBeenCalledTimes(0);
|
||||||
|
|
||||||
@ -173,9 +177,12 @@ export const ClickOutside: Story = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const Tab: Story = {
|
export const Tab: Story = {
|
||||||
play: async () => {
|
play: async ({ canvasElement }) => {
|
||||||
|
const canvas = within(canvasElement);
|
||||||
|
|
||||||
|
await canvas.findByPlaceholderText('Enter text');
|
||||||
|
|
||||||
expect(tabJestFn).toHaveBeenCalledTimes(0);
|
expect(tabJestFn).toHaveBeenCalledTimes(0);
|
||||||
await sleep(100);
|
|
||||||
|
|
||||||
await userEvent.keyboard('{tab}');
|
await userEvent.keyboard('{tab}');
|
||||||
|
|
||||||
@ -186,9 +193,12 @@ export const Tab: Story = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const ShiftTab: Story = {
|
export const ShiftTab: Story = {
|
||||||
play: async () => {
|
play: async ({ canvasElement }) => {
|
||||||
|
const canvas = within(canvasElement);
|
||||||
|
|
||||||
|
await canvas.findByPlaceholderText('Enter text');
|
||||||
|
|
||||||
expect(shiftTabJestFn).toHaveBeenCalledTimes(0);
|
expect(shiftTabJestFn).toHaveBeenCalledTimes(0);
|
||||||
await sleep(100);
|
|
||||||
|
|
||||||
await userEvent.keyboard('{shift>}{tab}');
|
await userEvent.keyboard('{shift>}{tab}');
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,15 @@
|
|||||||
|
import { WORKER_QUEUE_METRICS_SELECT_OPTIONS } from '@/settings/admin-panel/health-status/constants/WorkerQueueMetricsSelectOptions';
|
||||||
import { Select } from '@/ui/input/components/Select';
|
import { Select } from '@/ui/input/components/Select';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
import { H2Title } from 'twenty-ui/display';
|
||||||
|
import { Section } from 'twenty-ui/layout';
|
||||||
import {
|
import {
|
||||||
AdminPanelWorkerQueueHealth,
|
AdminPanelWorkerQueueHealth,
|
||||||
QueueMetricsTimeRange,
|
QueueMetricsTimeRange,
|
||||||
} from '~/generated/graphql';
|
} from '~/generated/graphql';
|
||||||
import { WorkerMetricsGraph } from './WorkerMetricsGraph';
|
import { WorkerMetricsGraph } from './WorkerMetricsGraph';
|
||||||
import { H2Title } from 'twenty-ui/display';
|
|
||||||
import { Section } from 'twenty-ui/layout';
|
|
||||||
|
|
||||||
type WorkerQueueMetricsSectionProps = {
|
type WorkerQueueMetricsSectionProps = {
|
||||||
queue: AdminPanelWorkerQueueHealth;
|
queue: AdminPanelWorkerQueueHealth;
|
||||||
@ -39,19 +40,10 @@ export const WorkerQueueMetricsSection = ({
|
|||||||
<Select
|
<Select
|
||||||
dropdownId={`timerange-${queue.queueName}`}
|
dropdownId={`timerange-${queue.queueName}`}
|
||||||
value={timeRange}
|
value={timeRange}
|
||||||
options={[
|
options={WORKER_QUEUE_METRICS_SELECT_OPTIONS.map((option) => ({
|
||||||
{ value: QueueMetricsTimeRange.SevenDays, label: t`This week` },
|
...option,
|
||||||
{ value: QueueMetricsTimeRange.OneDay, label: t`Today` },
|
label: t(option.label),
|
||||||
{
|
}))}
|
||||||
value: QueueMetricsTimeRange.TwelveHours,
|
|
||||||
label: t`Last 12 hours`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: QueueMetricsTimeRange.FourHours,
|
|
||||||
label: t`Last 4 hours`,
|
|
||||||
},
|
|
||||||
{ value: QueueMetricsTimeRange.OneHour, label: t`Last 1 hour` },
|
|
||||||
]}
|
|
||||||
onChange={setTimeRange}
|
onChange={setTimeRange}
|
||||||
needIconCheck
|
needIconCheck
|
||||||
selectSizeVariant="small"
|
selectSizeVariant="small"
|
||||||
|
|||||||
@ -0,0 +1,16 @@
|
|||||||
|
import { msg } from '@lingui/core/macro';
|
||||||
|
import { QueueMetricsTimeRange } from '~/generated/graphql';
|
||||||
|
|
||||||
|
export const WORKER_QUEUE_METRICS_SELECT_OPTIONS = [
|
||||||
|
{ value: QueueMetricsTimeRange.SevenDays, label: msg`This week` },
|
||||||
|
{ value: QueueMetricsTimeRange.OneDay, label: msg`Today` },
|
||||||
|
{
|
||||||
|
value: QueueMetricsTimeRange.TwelveHours,
|
||||||
|
label: msg`Last 12 hours`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: QueueMetricsTimeRange.FourHours,
|
||||||
|
label: msg`Last 4 hours`,
|
||||||
|
},
|
||||||
|
{ value: QueueMetricsTimeRange.OneHour, label: msg`Last 1 hour` },
|
||||||
|
];
|
||||||
@ -6,7 +6,8 @@ import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsO
|
|||||||
import { useBooleanSettingsFormInitialValues } from '@/settings/data-model/fields/forms/boolean/hooks/useBooleanSettingsFormInitialValues';
|
import { useBooleanSettingsFormInitialValues } from '@/settings/data-model/fields/forms/boolean/hooks/useBooleanSettingsFormInitialValues';
|
||||||
import { Select } from '@/ui/input/components/Select';
|
import { Select } from '@/ui/input/components/Select';
|
||||||
import { useLingui } from '@lingui/react/macro';
|
import { useLingui } from '@lingui/react/macro';
|
||||||
import { IconCheck, IconX } from 'twenty-ui/display';
|
import { IconCheck } from 'twenty-ui/display';
|
||||||
|
import { BOOLEAN_DATA_MODEL_SELECT_OPTIONS } from '@/settings/data-model/fields/forms/boolean/constants/BooleanDataModelSelectOptions';
|
||||||
|
|
||||||
export const settingsDataModelFieldBooleanFormSchema = z.object({
|
export const settingsDataModelFieldBooleanFormSchema = z.object({
|
||||||
defaultValue: z.boolean(),
|
defaultValue: z.boolean(),
|
||||||
@ -47,18 +48,10 @@ export const SettingsDataModelFieldBooleanForm = ({
|
|||||||
dropdownId="object-field-default-value-select-boolean"
|
dropdownId="object-field-default-value-select-boolean"
|
||||||
dropdownWidth={120}
|
dropdownWidth={120}
|
||||||
needIconCheck={false}
|
needIconCheck={false}
|
||||||
options={[
|
options={BOOLEAN_DATA_MODEL_SELECT_OPTIONS.map((option) => ({
|
||||||
{
|
...option,
|
||||||
value: true,
|
label: t(option.label),
|
||||||
label: t`True`,
|
}))}
|
||||||
Icon: IconCheck,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: false,
|
|
||||||
label: t`False`,
|
|
||||||
Icon: IconX,
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
selectSizeVariant="small"
|
selectSizeVariant="small"
|
||||||
/>
|
/>
|
||||||
</SettingsOptionCardContentSelect>
|
</SettingsOptionCardContentSelect>
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
import { msg } from '@lingui/core/macro';
|
||||||
|
import { IconCheck, IconX } from 'twenty-ui/display';
|
||||||
|
|
||||||
|
export const BOOLEAN_DATA_MODEL_SELECT_OPTIONS = [
|
||||||
|
{
|
||||||
|
value: true,
|
||||||
|
label: msg`True`,
|
||||||
|
Icon: IconCheck,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: false,
|
||||||
|
label: msg`False`,
|
||||||
|
Icon: IconX,
|
||||||
|
},
|
||||||
|
];
|
||||||
@ -2,10 +2,11 @@ import { Controller, useFormContext } from 'react-hook-form';
|
|||||||
|
|
||||||
import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
|
import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
|
||||||
import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect';
|
import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect';
|
||||||
|
import { TEXT_DATA_MODEL_SELECT_OPTIONS } from '@/settings/data-model/fields/forms/components/text/constants/TextDataModelSelectOptions';
|
||||||
import { Select } from '@/ui/input/components/Select';
|
import { Select } from '@/ui/input/components/Select';
|
||||||
import { z } from 'zod';
|
import { useLingui } from '@lingui/react/macro';
|
||||||
import { t } from '@lingui/core/macro';
|
|
||||||
import { IconTextWrap } from 'twenty-ui/display';
|
import { IconTextWrap } from 'twenty-ui/display';
|
||||||
|
import { z } from 'zod';
|
||||||
|
|
||||||
type SettingsDataModelFieldTextFormProps = {
|
type SettingsDataModelFieldTextFormProps = {
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
@ -31,6 +32,8 @@ export const SettingsDataModelFieldTextForm = ({
|
|||||||
disabled,
|
disabled,
|
||||||
fieldMetadataItem,
|
fieldMetadataItem,
|
||||||
}: SettingsDataModelFieldTextFormProps) => {
|
}: SettingsDataModelFieldTextFormProps) => {
|
||||||
|
const { t } = useLingui();
|
||||||
|
|
||||||
const { control } = useFormContext<SettingsDataModelFieldTextFormValues>();
|
const { control } = useFormContext<SettingsDataModelFieldTextFormValues>();
|
||||||
return (
|
return (
|
||||||
<Controller
|
<Controller
|
||||||
@ -54,28 +57,10 @@ export const SettingsDataModelFieldTextForm = ({
|
|||||||
value={displayedMaxRows}
|
value={displayedMaxRows}
|
||||||
onChange={(value) => onChange({ displayedMaxRows: value })}
|
onChange={(value) => onChange({ displayedMaxRows: value })}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
options={[
|
options={TEXT_DATA_MODEL_SELECT_OPTIONS.map((option) => ({
|
||||||
{
|
...option,
|
||||||
label: t`Deactivated`,
|
label: t(option.label),
|
||||||
value: 0,
|
}))}
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t`First 2 lines`,
|
|
||||||
value: 2,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t`First 5 lines`,
|
|
||||||
value: 5,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t`First 10 lines`,
|
|
||||||
value: 10,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t`All lines`,
|
|
||||||
value: 99,
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
selectSizeVariant="small"
|
selectSizeVariant="small"
|
||||||
/>
|
/>
|
||||||
</SettingsOptionCardContentSelect>
|
</SettingsOptionCardContentSelect>
|
||||||
|
|||||||
@ -0,0 +1,24 @@
|
|||||||
|
import { msg } from '@lingui/core/macro';
|
||||||
|
|
||||||
|
export const TEXT_DATA_MODEL_SELECT_OPTIONS = [
|
||||||
|
{
|
||||||
|
label: msg`Deactivated`,
|
||||||
|
value: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: msg`First 2 lines`,
|
||||||
|
value: 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: msg`First 5 lines`,
|
||||||
|
value: 5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: msg`First 10 lines`,
|
||||||
|
value: 10,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: msg`All lines`,
|
||||||
|
value: 99,
|
||||||
|
},
|
||||||
|
];
|
||||||
@ -7,14 +7,10 @@ import { Separator } from '@/settings/components/Separator';
|
|||||||
import { SettingsOptionCardContentCounter } from '@/settings/components/SettingsOptions/SettingsOptionCardContentCounter';
|
import { SettingsOptionCardContentCounter } from '@/settings/components/SettingsOptions/SettingsOptionCardContentCounter';
|
||||||
import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect';
|
import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect';
|
||||||
import { Select } from '@/ui/input/components/Select';
|
import { Select } from '@/ui/input/components/Select';
|
||||||
|
import { useLingui } from '@lingui/react/macro';
|
||||||
|
import { IconDecimal, IconEye } from 'twenty-ui/display';
|
||||||
import { DEFAULT_DECIMAL_VALUE } from '~/utils/format/number';
|
import { DEFAULT_DECIMAL_VALUE } from '~/utils/format/number';
|
||||||
import { t } from '@lingui/core/macro';
|
import { NUMBER_DATA_MODEL_SELECT_OPTIONS } from '@/settings/data-model/fields/forms/number/constants/NumberDataModelSelectOptions';
|
||||||
import {
|
|
||||||
IconDecimal,
|
|
||||||
IconEye,
|
|
||||||
IconNumber9,
|
|
||||||
IconPercentage,
|
|
||||||
} from 'twenty-ui/display';
|
|
||||||
|
|
||||||
export const settingsDataModelFieldNumberFormSchema = z.object({
|
export const settingsDataModelFieldNumberFormSchema = z.object({
|
||||||
settings: numberFieldDefaultValueSchema,
|
settings: numberFieldDefaultValueSchema,
|
||||||
@ -36,6 +32,7 @@ export const SettingsDataModelFieldNumberForm = ({
|
|||||||
disabled,
|
disabled,
|
||||||
fieldMetadataItem,
|
fieldMetadataItem,
|
||||||
}: SettingsDataModelFieldNumberFormProps) => {
|
}: SettingsDataModelFieldNumberFormProps) => {
|
||||||
|
const { t } = useLingui();
|
||||||
const { control } = useFormContext<SettingsDataModelFieldNumberFormValues>();
|
const { control } = useFormContext<SettingsDataModelFieldNumberFormValues>();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -66,18 +63,10 @@ export const SettingsDataModelFieldNumberForm = ({
|
|||||||
onChange={(value) => onChange({ type: value, decimals: count })}
|
onChange={(value) => onChange({ type: value, decimals: count })}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
needIconCheck={false}
|
needIconCheck={false}
|
||||||
options={[
|
options={NUMBER_DATA_MODEL_SELECT_OPTIONS.map((option) => ({
|
||||||
{
|
...option,
|
||||||
Icon: IconNumber9,
|
label: t(option.label),
|
||||||
label: t`Number`,
|
}))}
|
||||||
value: 'number',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Icon: IconPercentage,
|
|
||||||
label: t`Percentage`,
|
|
||||||
value: 'percentage',
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
/>
|
||||||
</SettingsOptionCardContentSelect>
|
</SettingsOptionCardContentSelect>
|
||||||
<Separator />
|
<Separator />
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
import { msg } from '@lingui/core/macro';
|
||||||
|
import { IconNumber9, IconPercentage } from 'twenty-ui/display';
|
||||||
|
|
||||||
|
export const NUMBER_DATA_MODEL_SELECT_OPTIONS = [
|
||||||
|
{
|
||||||
|
Icon: IconNumber9,
|
||||||
|
label: msg`Number`,
|
||||||
|
value: 'number',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Icon: IconPercentage,
|
||||||
|
label: msg`Percentage`,
|
||||||
|
value: 'percentage',
|
||||||
|
},
|
||||||
|
];
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { PLAYGROUND_SETUP_SELECT_OPTIONS } from '@/settings/playground/constants/PlaygroundSetupSelectOptions';
|
||||||
import { playgroundApiKeyState } from '@/settings/playground/states/playgroundApiKeyState';
|
import { playgroundApiKeyState } from '@/settings/playground/states/playgroundApiKeyState';
|
||||||
import { PlaygroundSchemas } from '@/settings/playground/types/PlaygroundSchemas';
|
import { PlaygroundSchemas } from '@/settings/playground/types/PlaygroundSchemas';
|
||||||
import { PlaygroundTypes } from '@/settings/playground/types/PlaygroundTypes';
|
import { PlaygroundTypes } from '@/settings/playground/types/PlaygroundTypes';
|
||||||
@ -9,12 +10,7 @@ import { zodResolver } from '@hookform/resolvers/zod';
|
|||||||
import { useLingui } from '@lingui/react/macro';
|
import { useLingui } from '@lingui/react/macro';
|
||||||
import { Controller, useForm } from 'react-hook-form';
|
import { Controller, useForm } from 'react-hook-form';
|
||||||
import { useRecoilState } from 'recoil';
|
import { useRecoilState } from 'recoil';
|
||||||
import {
|
import { IconApi, IconBrandGraphql } from 'twenty-ui/display';
|
||||||
IconApi,
|
|
||||||
IconBracketsAngle,
|
|
||||||
IconBrandGraphql,
|
|
||||||
IconFolderRoot,
|
|
||||||
} from 'twenty-ui/display';
|
|
||||||
import { Button } from 'twenty-ui/input';
|
import { Button } from 'twenty-ui/input';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
||||||
@ -137,18 +133,10 @@ export const PlaygroundSetupForm = () => {
|
|||||||
<Select
|
<Select
|
||||||
dropdownId="schema"
|
dropdownId="schema"
|
||||||
label={t`Schema`}
|
label={t`Schema`}
|
||||||
options={[
|
options={PLAYGROUND_SETUP_SELECT_OPTIONS.map((option) => ({
|
||||||
{
|
...option,
|
||||||
value: PlaygroundSchemas.CORE,
|
label: t(option.label),
|
||||||
label: t`Core`,
|
}))}
|
||||||
Icon: IconFolderRoot,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: PlaygroundSchemas.METADATA,
|
|
||||||
label: t`Metadata`,
|
|
||||||
Icon: IconBracketsAngle,
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -0,0 +1,16 @@
|
|||||||
|
import { PlaygroundTypes } from '@/settings/playground/types/PlaygroundTypes';
|
||||||
|
import { msg } from '@lingui/core/macro';
|
||||||
|
import { IconApi, IconBrandGraphql } from 'twenty-ui/display';
|
||||||
|
|
||||||
|
export const PLAYGROUND_SETUP_SELECT_OPTIONS = [
|
||||||
|
{
|
||||||
|
value: PlaygroundTypes.REST,
|
||||||
|
label: msg`REST`,
|
||||||
|
Icon: IconApi,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: PlaygroundTypes.GRAPHQL,
|
||||||
|
label: msg`GraphQL`,
|
||||||
|
Icon: IconBrandGraphql,
|
||||||
|
},
|
||||||
|
];
|
||||||
@ -35,6 +35,7 @@ import { viewPickerTypeComponentState } from '@/views/view-picker/states/viewPic
|
|||||||
import { useLingui } from '@lingui/react/macro';
|
import { useLingui } from '@lingui/react/macro';
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { IconX } from 'twenty-ui/display';
|
import { IconX } from 'twenty-ui/display';
|
||||||
|
import { VIEW_PICKER_TYPE_SELECT_OPTIONS } from '@/views/view-picker/constants/ViewPickerTypeSelectOptions';
|
||||||
|
|
||||||
const StyledNoKanbanFieldAvailableContainer = styled.div`
|
const StyledNoKanbanFieldAvailableContainer = styled.div`
|
||||||
color: ${({ theme }) => theme.font.color.light};
|
color: ${({ theme }) => theme.font.color.light};
|
||||||
@ -163,18 +164,10 @@ export const ViewPickerContentCreateMode = () => {
|
|||||||
setViewPickerIsDirty(true);
|
setViewPickerIsDirty(true);
|
||||||
setViewPickerType(value);
|
setViewPickerType(value);
|
||||||
}}
|
}}
|
||||||
options={[
|
options={VIEW_PICKER_TYPE_SELECT_OPTIONS.map((option) => ({
|
||||||
{
|
...option,
|
||||||
value: ViewType.Table,
|
label: t(option.label),
|
||||||
label: t`Table`,
|
}))}
|
||||||
Icon: viewTypeIconMapping(ViewType.Table),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: ViewType.Kanban,
|
|
||||||
label: t`Kanban`,
|
|
||||||
Icon: viewTypeIconMapping(ViewType.Kanban),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
dropdownId={VIEW_PICKER_VIEW_TYPE_DROPDOWN_ID}
|
dropdownId={VIEW_PICKER_VIEW_TYPE_DROPDOWN_ID}
|
||||||
/>
|
/>
|
||||||
</ViewPickerSelectContainer>
|
</ViewPickerSelectContainer>
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
import { ViewType, viewTypeIconMapping } from '@/views/types/ViewType';
|
||||||
|
import { msg } from '@lingui/core/macro';
|
||||||
|
|
||||||
|
export const VIEW_PICKER_TYPE_SELECT_OPTIONS = [
|
||||||
|
{
|
||||||
|
value: ViewType.Table,
|
||||||
|
label: msg`Table`,
|
||||||
|
Icon: viewTypeIconMapping(ViewType.Table),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: ViewType.Kanban,
|
||||||
|
label: msg`Kanban`,
|
||||||
|
Icon: viewTypeIconMapping(ViewType.Kanban),
|
||||||
|
},
|
||||||
|
];
|
||||||
0
packages/twenty-server/scripts/render-run.sh
Executable file → Normal file
0
packages/twenty-server/scripts/render-run.sh
Executable file → Normal file
0
packages/twenty-server/scripts/render-worker.sh
Executable file → Normal file
0
packages/twenty-server/scripts/render-worker.sh
Executable file → Normal file
0
packages/twenty-server/scripts/ssl-generation/script.sh
Executable file → Normal file
0
packages/twenty-server/scripts/ssl-generation/script.sh
Executable file → Normal file
Reference in New Issue
Block a user