Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev -> Sb #2917

Merged
merged 9 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Once the process is complete, _2 tabs_ will open in your browser:
We appreciate all types of contributions and believe that an active community is the secret to a rich and stable product.
Here are some of the ways you can contribute:

- Give us feedback in our [Slack community](https://join.slack.com/t/ballerine-oss/shared_invite/zt-1iu6otkok-OqBF3TrcpUmFd9oUjNs2iw)
- Give us feedback in our [Slack community](https://join.slack.com/t/ballerine-oss/shared_invite/zt-1il7txerq-K0YrXtlzMttGgD3XXYxlfw)
- Help with bugs and features on [our Issues page](https://github.com/ballerine-io/ballerine/issues)
- Submit a [feature request](https://github.com/ballerine-io/ballerine/issues/new?assignees=&labels=enhancement%2C+feature&template=feature_request.md) or [bug report](https://github.com/ballerine-io/ballerine/issues/new?assignees=&labels=bug&template=bug_report.md)

Expand Down
8 changes: 8 additions & 0 deletions apps/backoffice-v2/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,13 @@ const config: StorybookConfig = {
docs: {
autodocs: true,
},
viteFinal: config => {
config.optimizeDeps = {
...config.optimizeDeps,
include: ['@ballerine/ui'],
};

return config;
},
};
export default config;
33 changes: 33 additions & 0 deletions apps/backoffice-v2/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# @ballerine/backoffice-v2

## 0.7.84

### Patch Changes

- Updated dependencies
- @ballerine/[email protected]
- @ballerine/[email protected]
- @ballerine/[email protected]
- @ballerine/[email protected]
- @ballerine/[email protected]

## 0.7.83

### Patch Changes

- added command.loading
- Updated dependencies
- @ballerine/[email protected]
- @ballerine/[email protected]

## 0.7.82

### Patch Changes

- core
- Updated dependencies
- @ballerine/[email protected]
- @ballerine/[email protected]
- @ballerine/[email protected]
- @ballerine/[email protected]
- @ballerine/[email protected]
- @ballerine/[email protected]

## 0.7.81

### Patch Changes
Expand Down
18 changes: 9 additions & 9 deletions apps/backoffice-v2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ballerine/backoffice-v2",
"version": "0.7.81",
"version": "0.7.84",
"description": "Ballerine - Backoffice",
"homepage": "https://github.com/ballerine-io/ballerine",
"type": "module",
Expand Down Expand Up @@ -51,12 +51,12 @@
"preview": "vite preview"
},
"dependencies": {
"@ballerine/blocks": "0.2.29",
"@ballerine/common": "0.9.58",
"@ballerine/react-pdf-toolkit": "^1.2.50",
"@ballerine/ui": "^0.5.50",
"@ballerine/workflow-browser-sdk": "0.6.77",
"@ballerine/workflow-node-sdk": "0.6.77",
"@ballerine/blocks": "0.2.30",
"@ballerine/common": "0.9.60",
"@ballerine/react-pdf-toolkit": "^1.2.54",
"@ballerine/ui": "^0.5.54",
"@ballerine/workflow-browser-sdk": "0.6.79",
"@ballerine/workflow-node-sdk": "0.6.79",
"@botpress/webchat": "^2.1.10",
"@botpress/webchat-generator": "^0.2.9",
"@fontsource/inter": "^4.5.15",
Expand Down Expand Up @@ -148,8 +148,8 @@
"zod": "^3.23.4"
},
"devDependencies": {
"@ballerine/config": "^1.1.27",
"@ballerine/eslint-config-react": "^2.0.27",
"@ballerine/config": "^1.1.28",
"@ballerine/eslint-config-react": "^2.0.28",
"@cspell/cspell-types": "^6.31.1",
"@faker-js/faker": "^7.6.0",
"@playwright/test": "^1.32.1",
Expand Down
8 changes: 8 additions & 0 deletions apps/backoffice-v2/public/locales/en/toast.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,13 @@
"update_details": {
"success": "Details updated successfully.",
"error": "Error occurred while updating details."
},
"ubo_created": {
"success": "UBO successfully added",
"error": "Error adding UBO"
},
"ubo_deleted": {
"success": "UBO successfully removed",
"error": "Error removing UBO"
}
}
8 changes: 4 additions & 4 deletions apps/backoffice-v2/src/common/api-client/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { z, ZodSchema } from 'zod';
export interface IApiClient {
<TBody extends AnyRecord, TZodSchema extends ZodSchema>(params: {
endpoint: string;
method: typeof Method.POST | typeof Method.PUT | typeof Method.PATCH;
method: typeof Method.POST | typeof Method.PUT | typeof Method.PATCH | typeof Method.DELETE;
body?: TBody;
options?: Omit<RequestInit, 'body'>;
timeout?: number;
Expand All @@ -19,7 +19,7 @@ export interface IApiClient {

<TBody extends AnyRecord, TZodSchema extends ZodSchema>(params: {
url: string;
method: typeof Method.POST | typeof Method.PUT | typeof Method.PATCH;
method: typeof Method.POST | typeof Method.PUT | typeof Method.PATCH | typeof Method.DELETE;
body?: TBody;
options?: Omit<RequestInit, 'body'>;
timeout?: number;
Expand All @@ -30,7 +30,7 @@ export interface IApiClient {

<TZodSchema extends ZodSchema>(params: {
endpoint: string;
method: typeof Method.GET | typeof Method.DELETE;
method: typeof Method.GET;
options?: Omit<RequestInit, 'body'>;
timeout?: number;
schema: TZodSchema;
Expand All @@ -39,7 +39,7 @@ export interface IApiClient {

<TZodSchema extends ZodSchema>(params: {
url: string;
method: typeof Method.GET | typeof Method.DELETE;
method: typeof Method.GET;
options?: Omit<RequestInit, 'body'>;
timeout?: number;
schema: TZodSchema;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ReactNode, useCallback, useState } from 'react';
import { CheckIcon, PlusCircledIcon } from '@radix-ui/react-icons';
import { ReactNode, useCallback } from 'react';
import {
Badge,
Button,
Expand All @@ -8,13 +9,14 @@ import {
CommandInput,
CommandItem,
CommandList,
CommandLoading,
CommandSeparator,
ctw,
Popover,
PopoverContent,
PopoverTrigger,
} from '@ballerine/ui';
import { CheckIcon, PlusCircledIcon } from '@radix-ui/react-icons';

import { Separator } from '@/common/components/atoms/Separator/Separator';

interface IMultiSelectProps<
Expand All @@ -25,10 +27,24 @@ interface IMultiSelectProps<
},
> {
title: string;
isLoading?: boolean;
selectedValues: Array<TOption['value']>;
onSelect: (value: Array<TOption['value']>) => void;
onClearSelect: () => void;
options: TOption[];
props?: {
content?: {
className?: string;
};
trigger?: {
leftIcon?: JSX.Element;
rightIcon?: JSX.Element;
className?: string;
title?: {
className?: string;
};
};
};
}

export const MultiSelect = <
Expand All @@ -39,32 +55,37 @@ export const MultiSelect = <
},
>({
title,
selectedValues,
isLoading,
selectedValues: selected,
onSelect,
onClearSelect,
options,
props,
}: IMultiSelectProps<TOption>) => {
const [selected, setSelected] = useState(selectedValues);

const onSelectChange = useCallback(
(value: TOption['value']) => {
const isSelected = selected.some(selectedValue => selectedValue === value);
const nextSelected = isSelected
? selected.filter(selectedValue => selectedValue !== value)
: [...selected, value];

setSelected(nextSelected);
onSelect(nextSelected);
},
[onSelect, selected],
);

const TriggerLeftIcon = props?.trigger?.leftIcon ?? <PlusCircledIcon className="mr-2 h-4 w-4" />;

return (
<Popover>
<PopoverTrigger asChild>
<Button variant="outline" size="sm" className="h-8 border">
<PlusCircledIcon className="mr-2 h-4 w-4" />
{title}
<Button
variant="outline"
size="sm"
className={ctw(`h-8 border`, props?.trigger?.className)}
>
{TriggerLeftIcon}
<span className={ctw(props?.trigger?.title?.className)}>{title}</span>
{selected?.length > 0 && (
<>
<Separator orientation="vertical" className="mx-2 h-4" />
Expand All @@ -81,9 +102,9 @@ export const MultiSelect = <
.filter(option => selected.some(value => value === option.value))
.map(option => (
<Badge
key={`${option.value}`}
variant="secondary"
key={option.value}
className="rounded-sm px-1 font-normal"
className="max-w-[20ch] truncate rounded-sm px-1 font-normal"
>
{option.label}
</Badge>
Expand All @@ -92,52 +113,63 @@ export const MultiSelect = <
</div>
</>
)}
{props?.trigger?.rightIcon}
</Button>
</PopoverTrigger>
<PopoverContent className="w-[200px] p-0" align="start">
<Command>
<PopoverContent className={ctw(`w-[200px] p-0`, props?.content?.className)} align="start">
<Command filter={(value, search) => (value.includes(search) ? 1 : 0)}>
<CommandInput placeholder={title} />
<CommandList>
<CommandEmpty>No results found.</CommandEmpty>
<CommandGroup>
{options.map(option => {
const isSelected = selected.some(value => value === option.value);
{isLoading && (
<CommandLoading className={`flex items-center justify-center pb-3 text-sm`}>
Loading...
</CommandLoading>
)}
{!isLoading && options.length === 0 && <CommandEmpty>No results found.</CommandEmpty>}
{!isLoading && options.length > 0 && (
<CommandGroup>
<div className={`max-h-[250px] overflow-y-auto`}>
{options.map(option => {
const isSelected = selected.some(value => value === option.value);

return (
<CommandItem key={option.value} onSelect={() => onSelectChange(option.value)}>
<div
className={ctw(
'mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary',
isSelected
? 'bg-primary text-primary-foreground'
: 'opacity-50 [&_svg]:invisible',
)}
>
<CheckIcon className={ctw('h-4 w-4')} />
</div>
{option.icon}
<span>{option.label}</span>
</CommandItem>
);
})}
</CommandGroup>
{selected?.length > 0 && (
<>
<CommandSeparator />
<CommandGroup>
<CommandItem
onSelect={() => {
onClearSelect();
setSelected([]);
}}
className="justify-center text-center"
>
Clear filters
</CommandItem>
</CommandGroup>
</>
return (
<CommandItem
value={option.label}
key={`${option.value}`}
className={`cursor-pointer`}
onSelect={() => onSelectChange(option.value)}
>
<div
className={ctw(
'mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary',
isSelected
? 'bg-primary text-primary-foreground'
: 'opacity-50 [&_svg]:invisible',
)}
>
<CheckIcon className={ctw('h-4 w-4')} />
</div>
{option.icon}
<span>{option.label}</span>
</CommandItem>
);
})}
</div>
</CommandGroup>
)}
</CommandList>
<CommandSeparator />
<CommandGroup>
<CommandItem
onSelect={onClearSelect}
className={ctw(
`cursor-pointer justify-center text-center`,
selected.length === 0 && 'pointer-events-none opacity-50',
)}
>
Clear filters
</CommandItem>
</CommandGroup>
</Command>
</PopoverContent>
</Popover>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,35 @@ import { Calendar } from '../../organisms/Calendar/Calendar';
type TDateRangePickerProps = {
onChange: NonNullable<ComponentProps<typeof Calendar>['onSelect']>;
value: NonNullable<ComponentProps<typeof Calendar>['selected']>;
placeholder?: string;
className?: ComponentProps<'div'>['className'];
};

export const DateRangePicker = ({ onChange, value, className }: TDateRangePickerProps) => {
export const DateRangePicker = ({
onChange,
value,
placeholder,
className,
}: TDateRangePickerProps) => {
return (
<div className={ctw('grid gap-2', className)}>
<Popover>
<PopoverTrigger asChild>
<Button
id="date"
variant={'outline'}
className={ctw('w-[300px] justify-start text-left font-normal', {
className={ctw('h-8 w-[250px] justify-start text-left font-normal', {
'text-muted-foreground': !value,
})}
>
<CalendarIcon className="size-4 mr-2" />
<CalendarIcon className="mr-2 d-4" />
{value?.from && value?.to && (
<>
{formatDate(value.from, 'LLL dd, y')} - {formatDate(value.to, 'LLL dd, y')}
</>
)}
{value?.from && !value?.to && formatDate(value.from, 'LLL dd, y')}
{!value?.from && !value?.to && <span>Pick a date</span>}
{!value?.from && !value?.to && <span>{placeholder ?? 'Pick a date'}</span>}
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
Expand Down
Loading
Loading