Skip to content

Commit

Permalink
Merge branch 'main' into fix/upload-picture-bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Weiko authored Nov 14, 2024
2 parents d83400b + a799370 commit f02c7e4
Show file tree
Hide file tree
Showing 187 changed files with 2,298 additions and 1,634 deletions.
31 changes: 11 additions & 20 deletions .github/workflows/ci-tinybird.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,24 @@ on:
push:
branches:
- main
paths:
- 'package.json'
- 'packages/twenty-tinybird/**'

pull_request:
paths:
- 'package.json'
- 'packages/twenty-tinybird/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ci:
timeout-minutes: 10
runs-on: ubuntu-latest
uses: tinybirdco/ci/.github/workflows/ci.yml@main
steps:
- name: Check for changed files
id: changed-files
uses: tj-actions/changed-files@v11
with:
files: |
package.json
packages/twenty-tinybird/**
- name: Skip if no relevant changes
if: steps.changed-files.outputs.any_changed == 'false'
run: echo "No relevant changes. Skipping CI."

- name: Check twenty-tinybird package
with:
data_project_dir: packages/twenty-tinybird
tb_admin_token: ${{ secrets.TB_ADMIN_TOKEN }}
tb_host: https://api.eu-central-1.aws.tinybird.co
with:
data_project_dir: packages/twenty-tinybird
secrets:
tb_admin_token: ${{ secrets.TB_ADMIN_TOKEN }}
tb_host: https://api.eu-central-1.aws.tinybird.co
2 changes: 1 addition & 1 deletion packages/twenty-emails/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "twenty-emails",
"version": "0.33.0-canaray",
"version": "0.33.0-canary",
"description": "",
"author": "",
"private": true,
Expand Down
17 changes: 16 additions & 1 deletion packages/twenty-front/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<link rel="icon" href="/icons/android/android-launchericon-48-48.png" />
<link rel="apple-touch-icon" href="/icons/ios/192.png" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="A modern open-source CRM" />
<meta
Expand All @@ -30,6 +29,22 @@

<title>Twenty</title>
<script src="/env-config.js"></script>

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script type="module">
const disableInputAutoZoom = () => {
const viewportMetadata = document.querySelector('meta[name=viewport]');

if (viewportMetadata !== null) {
viewportMetadata.setAttribute('content', 'width=device-width, initial-scale=1.0, maximum-scale=1.0');
}
}

const isIOS = /iPad|iPhone/.test(navigator.userAgent);
if (isIOS) {
disableInputAutoZoom();
}
</script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
2 changes: 1 addition & 1 deletion packages/twenty-front/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "twenty-front",
"version": "0.33.0-canaray",
"version": "0.33.0-canary",
"private": true,
"type": "module",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { FooterNote } from '@/auth/sign-in-up/components/FooterNote';
import { HorizontalSeparator } from '@/auth/sign-in-up/components/HorizontalSeparator';
import {
HorizontalSeparator,
ActionLink,
IconGoogle,
IconKey,
IconMicrosoft,
Loader,
MainButton,
StyledText,
} from 'twenty-ui';
import { useHandleResetPassword } from '@/auth/sign-in-up/hooks/useHandleResetPassword';
import { SignInUpMode, useSignInUp } from '@/auth/sign-in-up/hooks/useSignInUp';
import {
Expand All @@ -20,15 +29,6 @@ import { useMemo, useState } from 'react';
import { Controller } from 'react-hook-form';
import { useRecoilState, useRecoilValue } from 'recoil';
import { Key } from 'ts-key-enum';
import {
ActionLink,
IconGoogle,
IconKey,
IconMicrosoft,
Loader,
MainButton,
StyledText,
} from 'twenty-ui';
import { isDefined } from '~/utils/isDefined';

const StyledContentContainer = styled.div`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNaviga
import { navigationDrawerExpandedMemorizedState } from '@/ui/navigation/states/navigationDrawerExpandedMemorizedState';
import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState';
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import styled from '@emotion/styled';

const StyledMainSection = styled(NavigationDrawerSection)`
Expand All @@ -27,9 +26,7 @@ export const MainNavigationDrawerItems = () => {
const setNavigationMemorizedUrl = useSetRecoilState(
navigationMemorizedUrlState,
);
const isWorkspaceFavoriteEnabled = useIsFeatureEnabled(
'IS_WORKSPACE_FAVORITE_ENABLED',
);

const [isNavigationDrawerExpanded, setIsNavigationDrawerExpanded] =
useRecoilState(isNavigationDrawerExpandedState);
const setNavigationDrawerExpandedMemorized = useSetRecoilState(
Expand Down Expand Up @@ -58,18 +55,9 @@ export const MainNavigationDrawerItems = () => {
/>
</StyledMainSection>
)}

{isWorkspaceFavoriteEnabled && <NavigationDrawerOpenedSection />}

<NavigationDrawerOpenedSection />
<CurrentWorkspaceMemberFavorites />

{isWorkspaceFavoriteEnabled ? (
<WorkspaceFavorites />
) : (
<NavigationDrawerSectionForObjectMetadataItemsWrapper
isRemote={false}
/>
)}
<WorkspaceFavorites />
<NavigationDrawerSectionForObjectMetadataItemsWrapper isRemote={true} />
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const variables = {
description: null,
icon: undefined,
label: 'fieldLabel',
name: 'fieldLabel',
name: 'fieldlabel',
options: undefined,
settings: undefined,
objectMetadataId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,5 @@ export const formatFieldMetadataItemAsFieldDefinition = ({
metadata: fieldDefintionMetadata,
type: field.type,
}),
settings: field.settings,
};
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
import { computeMetadataNameFromLabelOrThrow } from '~/pages/settings/data-model/utils/compute-metadata-name-from-label.utils';
import { computeMetadataNameFromLabel } from '~/pages/settings/data-model/utils/compute-metadata-name-from-label.utils';

export const formatFieldMetadataItemInput = (
input: Partial<
Expand All @@ -22,7 +22,7 @@ export const formatFieldMetadataItemInput = (
description: input.description?.trim() ?? null,
icon: input.icon,
label,
name: label ? computeMetadataNameFromLabelOrThrow(label) : undefined,
name: label ? computeMetadataNameFromLabel(label) : undefined,
options: input.options,
settings: input.settings,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { errors } from '@/settings/data-model/fields/forms/utils/errorMessages';
import { z } from 'zod';

import { METADATA_LABEL_VALID_PATTERN } from '~/pages/settings/data-model/constants/MetadataLabelValidPattern';
import { computeMetadataNameFromLabelOrThrow } from '~/pages/settings/data-model/utils/compute-metadata-name-from-label.utils';
import { computeMetadataNameFromLabel } from '~/pages/settings/data-model/utils/compute-metadata-name-from-label.utils';
export const metadataLabelSchema = (existingLabels?: string[]) => {
return z
.string()
Expand All @@ -12,7 +12,7 @@ export const metadataLabelSchema = (existingLabels?: string[]) => {
.refine(
(label) => {
try {
computeMetadataNameFromLabelOrThrow(label);
computeMetadataNameFromLabel(label);
return true;
} catch (error) {
return false;
Expand All @@ -28,9 +28,7 @@ export const metadataLabelSchema = (existingLabels?: string[]) => {
if (!existingLabels || !label?.length) {
return true;
}
return !existingLabels.includes(
computeMetadataNameFromLabelOrThrow(label),
);
return !existingLabels.includes(computeMetadataNameFromLabel(label));
} catch (error) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { themeColorSchema } from 'twenty-ui';
import { z } from 'zod';

import { FieldMetadataItemOption } from '@/object-metadata/types/FieldMetadataItem';
import { computeOptionValueFromLabelOrThrow } from '~/pages/settings/data-model/utils/compute-option-value-from-label.utils';
import { computeOptionValueFromLabel } from '~/pages/settings/data-model/utils/compute-option-value-from-label.utils';

const selectOptionSchema = z
.object({
Expand All @@ -15,7 +15,7 @@ const selectOptionSchema = z
.refine(
(option) => {
try {
computeOptionValueFromLabelOrThrow(option.label);
computeOptionValueFromLabel(option.label);
return true;
} catch (error) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,7 @@ export const ObjectFilterDropdownFilterSelect = ({
</SelectableItem>
),
)}
</DropdownMenuItemsContainer>
{shoudShowSeparator && <DropdownMenuSeparator />}
<DropdownMenuItemsContainer>
{shoudShowSeparator && <DropdownMenuSeparator />}
{hiddenColumnsFilterDefinitions.map(
(hiddenFilterDefinition, index) => (
<SelectableItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownM
import { StyledHeaderDropdownButton } from '@/ui/layout/dropdown/components/StyledHeaderDropdownButton';
import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown';
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { useContext } from 'react';
import { SORT_DIRECTIONS } from '../types/SortDirection';

Expand Down Expand Up @@ -200,9 +200,7 @@ export const ObjectSortDropdownButton = ({
/>
),
)}
</DropdownMenuItemsContainer>
{shoudShowSeparator && <DropdownMenuSeparator />}
<DropdownMenuItemsContainer>
{shoudShowSeparator && <DropdownMenuSeparator />}
{hiddenColumnsSortDefinitions.map(
(hiddenSortDefinition, index) => (
<MenuItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ export const RecordBoardCard = ({
metadata: fieldDefinition.metadata,
type: fieldDefinition.type,
}),
settings: fieldDefinition.settings,
},
useUpdateRecord: useUpdateOneRecordHook,
hotkeyScope: InlineCellHotkeyScope.InlineCell,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { useNumberFieldDisplay } from '@/object-record/record-field/meta-types/hooks/useNumberFieldDisplay';
import { NumberDisplay } from '@/ui/field/display/components/NumberDisplay';
import { formatNumber } from '~/utils/format/number';

export const NumberFieldDisplay = () => {
const { fieldValue, fieldDefinition } = useNumberFieldDisplay();
return (
<NumberDisplay
value={fieldValue}
decimals={fieldDefinition.settings?.decimals}
/>
);
const decimals = fieldDefinition.metadata.settings?.decimals;
const type = fieldDefinition.metadata.settings?.type;
const value =
type === 'percentage' && fieldValue
? `${formatNumber(Number(fieldValue) * 100, decimals)}%`
: fieldValue
? formatNumber(Number(fieldValue), decimals)
: null;
return <NumberDisplay value={value} decimals={decimals} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
castAsNumberOrNull,
} from '~/utils/cast-as-number-or-null';

import { isNull } from '@sniptt/guards';
import { FieldContext } from '../../contexts/FieldContext';
import { usePersistField } from '../../hooks/usePersistField';
import { assertFieldMetadata } from '../../types/guards/assertFieldMetadata';
Expand All @@ -33,12 +34,23 @@ export const useNumberField = () => {
const persistField = usePersistField();

const persistNumberField = (newValue: string) => {
if (fieldDefinition?.metadata?.settings?.type === 'percentage') {
newValue = newValue.replaceAll('%', '');
if (!canBeCastAsNumberOrNull(newValue)) {
return;
}
const castedValue = castAsNumberOrNull(newValue);
if (!isNull(castedValue)) {
persistField(castedValue / 100);
return;
}
persistField(null);
return;
}
if (!canBeCastAsNumberOrNull(newValue)) {
return;
}

const castedValue = castAsNumberOrNull(newValue);

persistField(castedValue);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,4 @@ export type FieldDefinition<T extends FieldMetadata> = {
infoTooltipContent?: string;
defaultValue?: any;
editButtonIcon?: IconComponent;
settings?: {
decimals?: number;
};
};
Loading

0 comments on commit f02c7e4

Please sign in to comment.