Skip to content

Commit

Permalink
fix: Improvements & Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
muntean.gm committed Mar 18, 2024
1 parent efdc90a commit adfa31b
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 13 deletions.
6 changes: 4 additions & 2 deletions apps/frontend/components/composed/auth/SignInForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,17 @@ const SignInForm = () => {
});
toastSuccess({
text: t('sign_in_page.sign_in_success'),
duration: 1500
duration: 1500,
position: 'top-center'
});

setTimeout(() => {
login(access_token, refresh_token);
}, 1500);
} catch (e) {
toastError({
text: t('sign_in_page.sign_in_error')
text: t('sign_in_page.sign_in_error'),
position: 'top-center'
});
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ export const useVCCommonColumns = (onRefetch: () => void) => {
vcCommonColumnHelper.accessor('id', {
id: 'actions',
header: t('credentials.columns.actions'),
cell: ({ getValue }) => {
cell: ({ getValue, row }) => {
const status = row.original.status;
const actions = [
{
label: t('credentials.columns.view'),
Expand All @@ -149,7 +150,8 @@ export const useVCCommonColumns = (onRefetch: () => void) => {
id: getValue(),
status: VCStatus.APPROVED
});
}
},
disabled: status === VCStatus.APPROVED
},
{
label: t('credentials.columns.reject'),
Expand All @@ -158,12 +160,14 @@ export const useVCCommonColumns = (onRefetch: () => void) => {
id: getValue(),
status: VCStatus.REJECTED
});
}
},
disabled: status === VCStatus.REJECTED
},
{
label: t('credentials.columns.report'),
// eslint-disable-next-line
onClick: () => console.warn('report')
onClick: () => console.warn('report'),
disabled: true
}
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import {
BellIcon,
PlusIcon,
DocumentTextIcon,
QuestionMarkCircleIcon
} from '@heroicons/react/24/outline';
import { useTranslations } from 'next-intl';
Expand Down Expand Up @@ -61,15 +61,15 @@ const DashboardContent = () => {
className='w-full'
title={overall || t('global.n_a')}
label={t('dashboard.issued_credentials')}
icon={BellIcon}
icon={DocumentTextIcon}
link={routes.app.credentials.overall.home}
anchorText={t('dashboard.view_all_credentials')}
/>
<InfoCard
className='w-full'
title={pending || t('global.n_a')}
label={t('dashboard.pending_requests')}
icon={PlusIcon}
icon={BellIcon}
link={routes.app.credentials.pending.home}
anchorText={t('dashboard.view_pending_requests')}
/>
Expand Down
4 changes: 3 additions & 1 deletion apps/frontend/components/ui/ActionMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { FilterButton } from '@ui/table/filters/FilterWrapper';

type ActionMenuItem = {
label: string;
disabled?: boolean;
} & ({ onClick: () => void } | { href: string });

type ActionMenuProps = {
Expand Down Expand Up @@ -38,13 +39,14 @@ const ActionMenu: FC<ActionMenuProps> = ({ title, items = [], disabled }) => (
<div>
{items.map((item) => {
const classes =
'block w-full text-start px-3 py-2 truncate text-sm font-medium text-slate-800 hover:bg-slate-50 active:bg-slate-50 focus-visible:outline-none focus-visible:bg-slate-50';
'block w-full text-start disabled:cursor-not-allowed disabled:text-slate-600 disabled:bg-slate-200 px-3 py-2 truncate text-sm font-medium text-slate-800 hover:bg-slate-50 active:bg-slate-50 focus-visible:outline-none focus-visible:bg-slate-50';
if ('onClick' in item) {
return (
<button
className={classes}
onClick={item.onClick}
key={item.label}
disabled={item.disabled}
>
<span>{item.label}</span>
</button>
Expand Down
3 changes: 2 additions & 1 deletion apps/frontend/components/ui/Toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type ToastProps = {
duration?: number;
detailsLink?: string;
dismiss?: () => void;
position?: 'top-center' | 'top-right';
actionText?: string;
action?: () => void;
} & VariantProps<typeof toastVariants>;
Expand All @@ -27,7 +28,7 @@ const variantIcon = {
};

export const toastVariants = cva(
'group pointer-events-auto relative rounded-2xl flex w-full justify-between items-center gap-2 overflow-hidden p-4 shadow-1 transition-all max-w-screen-sm',
'group pointer-events-auto relative rounded-2xl flex justify-between items-center gap-2 overflow-hidden p-4 shadow-1 transition-all w-content-w',
{
variants: {
variant: {
Expand Down
1 change: 1 addition & 0 deletions apps/frontend/tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const config: Config = {
50: '12.5rem', // 200px
64: '16rem', // 256px
'4/5': '80%',
'content-w': 'calc(100% - 224px)',
'radix-popover-trigger': 'var(--radix-popover-trigger-width)'
},
maxHeight: {
Expand Down
8 changes: 6 additions & 2 deletions apps/frontend/utils/toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ export const toastInfo = (props: ToastProps) =>
variant: 'info'
});

const customToast = ({ duration = 3000, ...props }: ToastProps) => {
const customToast = ({
duration = 3000,
position = 'top-right',
...props
}: ToastProps) => {
toast.custom((t) => <Toast {...props} dismiss={() => toast.remove(t.id)} />, {
duration,
position: 'top-center'
position
});
};

1 comment on commit adfa31b

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for ebsi-vector-frontend ready!

✅ Preview
https://ebsi-vector-frontend-e6mygyecv-protokol.vercel.app

Built with commit adfa31b.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.