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

Sa fix #122

Merged
merged 5 commits into from
Dec 8, 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 apps/api/src/modules/groups/groups.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class GroupsController {
address: dto.address,
animatorName: dto.animatorName,
theme: { connect: { id: dto.themeId } },
Organization: { connect: { id: dto.organizationId } }
organization: { connect: { id: dto.organizationId } }
})
}

Expand Down
13 changes: 3 additions & 10 deletions apps/desk/src/renderer/src/assets/globals.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');
/* @import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap'); */

body {
font-family: 'Poppins', sans-serif;
}
Expand Down Expand Up @@ -36,18 +35,14 @@ body {
outline: 1px solid hsl(var(--primary));
}

/* .react-international-phone-country-selector-button__dropdown-arrow {
display: none;
} */

.react-international-phone-country-selector-button {
height: 100% !important;
border: 0 !important;
padding: 4px !important;
border-right: 1px solid #e2e2e2 !important;
border-radius: 6px 0 0 6px !important;
background-color: #f3f4f6 !important;
pointer-events: none; /* Prevent interaction */
pointer-events: none;
}

.react-international-phone-country-selector-button:hover {
Expand Down Expand Up @@ -86,8 +81,6 @@ body {
outline: 1px solid tomato;
}



.font-poppins {
font-family: "Poppins", sans-serif;
}
5 changes: 1 addition & 4 deletions apps/desk/src/renderer/src/components/EditeSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import useRegistrations from '@renderer/hooks/useRegistrations';
import { useTranslate } from '@renderer/hooks/useTranslate';
import { Card, CardContent, CardHeader } from './ui/card';
import { Card, CardContent } from './ui/card';
import { OrganizationFormData } from '@renderer/utils/schemas/formSchema';
import FormInputItem from './ui/form-input-item';
import { registrationFields } from '@renderer/data/organinzation-fields-input';
Expand All @@ -23,9 +23,6 @@ export default function EditeSettings({ data }: { data: OrganizationsData }) {
</h1>
<form onSubmit={methods.handleSubmit(handleSubmit)} className="space-y-6">
<Card className="flex flex-col gap-4 ">
{/* <CardHeader className="text-sm rounded-sm text-green-600 bg-green-100 font-bold p-1 m-2 w-fit">
{t('registration.title')}
</CardHeader> */}
<CardContent className="pt-4">
<div className="grid grid-cols-3 gap-4">
{registrationFields.map((field) => (
Expand Down
10 changes: 0 additions & 10 deletions apps/desk/src/renderer/src/components/ListingHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import ExportModal from './ExportModal'
import ImportModal from './ImportModal'
import { Button } from './ui/button'
import { FiPlus } from 'react-icons/fi'
// import { useNavigate } from '@tanstack/react-router'
import SearchTableInput from './costum-data/search-table-Input'
import { ChangeEventHandler } from 'react'
import Paragraph from './ui/Paragraph'

interface ListingHeaderProps {
headTitle: string;
Expand All @@ -20,14 +18,6 @@ const ListingHeader = ({
goAdd,
}: ListingHeaderProps): JSX.Element => {
const { t } = useTranslate();
// const navigate = useNavigate();
// const type =
// headTitle === 'formation.formation'
// ? 'themes'
// : headTitle === 'group.group'
// ? 'group'
// : 'participant';
// const href = `/edit?type=${type}&crud=add`;

return (
<div className="flex flex-col gap-6 w-full">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ export default function SearchTableInput({ onChange }: Props) {
<div className="relative">
<Input
placeholder={t('organization.searchPlaceholder')}
className="pl-10 text-gray-600 border border-gray-300 rounded-lg focus:ring-1 focus:ring-blue-400 focus:outline-none w-64"
// value={value}
className="pl-10 text-gray-600 border-2 border-gray-300 focus:border-blue-400 outline-0 rounded-lg w-64"
onChange={onChange}
/>
<FiSearch className="absolute top-[0.6rem] left-2 text-gray-400 h-5 w-5" />
Expand Down
9 changes: 6 additions & 3 deletions apps/desk/src/renderer/src/components/custom-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ export function CustomTable<TData, TValue>({

const { t } = useTranslate();

if (component === 'add' || component === 'edit'){
return <> {EditAndAddRowComponent} </>
if (component === 'add' || component === 'edit') {
return <> {EditAndAddRowComponent} </>;
// return <p className='text-xl text-gray-900'>isjgbsjdb</p>
}

Expand Down Expand Up @@ -176,7 +176,10 @@ export function CustomTable<TData, TValue>({
<p className="text-gray-500 mb-6">
Start adding your rows informations!
</p>
<button className="flex items-center px-4 py-2 bg-blue-500 text-white rounded-full shadow-md">
<button
onClick={setComponent.bind(null, 'add')}
className="flex items-center px-4 py-2 bg-blue-500 text-white rounded-full shadow-md"
>
<FaPlus className="mr-2" /> Add Rows
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const groupColumn = (
aria-label="Select all"
/>

{table.getIsSomeRowsSelected() && (
{table.getIsAllPageRowsSelected() && (
<DeleteModal
DeleteNumber={table.getFilteredSelectedRowModel().rows.length}
onDelete={() => {}}
Expand All @@ -48,7 +48,6 @@ export const groupColumn = (
aria-label="Select row"
key="checkbox"
/>
<p>{row.index + 1}</p>
<Paragraph paragraph={(row.index + 1).toString()} />
</div>
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export interface Participant {
status: string;
}

export const participantColumns = (setRowData: (rowData: Participant) => void): ColumnDef<Participant>[] => [
export const participantColumns = (
setRowData: (rowData: Participant) => void
): ColumnDef<Participant>[] => [
{
accessorKey: 'id',
header: ({ table }) => (
Expand All @@ -24,10 +26,10 @@ export const participantColumns = (setRowData: (rowData: Participant) => void):
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
aria-label="Select all"
/>
{table.getIsSomeRowsSelected() && (
{table.getIsAllPageRowsSelected() && (
<DeleteModal
DeleteNumber={table.getFilteredSelectedRowModel().rows.length}
onDelete={() => { }}
onDelete={() => {}}
/>
)}
</div>
Expand Down Expand Up @@ -92,7 +94,7 @@ export const participantColumns = (setRowData: (rowData: Participant) => void):
header: 'themesTable.options',
cell: ({ row }) => (
<ButtonsAction
endpoint='/participant/delete'
endpoint="/participant/delete"
saveDefaultData={setRowData.bind(null, row.original)}
rowId={row.original.id}
subscription={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const themeColumns = (
aria-label="Select all"
/>

{table.getIsSomeRowsSelected() && (
{table.getIsAllPageRowsSelected() && (
<DeleteModal
DeleteNumber={table.getFilteredSelectedRowModel().rows.length}
onDelete={() => { }}
Expand Down Expand Up @@ -99,7 +99,10 @@ export const themeColumns = (
accessorKey: 'groups',
header: 'themesTable.groups',
cell: ({ row }) => (
<RedirectButton click={setGroupThemes.bind(null, row.original.id, orgId)} text="themesTable.groups" />
<RedirectButton
click={setGroupThemes.bind(null, row.original.id, orgId)}
text="themesTable.groups"
/>
),
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const usersColumns = (
aria-label="Select all"
/>

{table.getIsSomeRowsSelected() && (
{table.getIsAllPageRowsSelected() && (
<DeleteModal
DeleteNumber={table.getFilteredSelectedRowModel().rows.length}
onDelete={() => {}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ export type Organization = {
address: string;
ice: string;
enabled: boolean;
// email: string;
// responsibleName: string;
// trainingManagerName: string;
// date: string;
};

export const Columns = (
Expand All @@ -41,7 +37,7 @@ export const Columns = (
aria-label="Select all"
/>

{table.getIsSomeRowsSelected() && (
{table.getIsAllPageRowsSelected() && (
<DeleteModal
DeleteNumber={table.getFilteredSelectedRowModel().rows.length}
onDelete={() => {}}
Expand Down
1 change: 0 additions & 1 deletion apps/desk/src/renderer/src/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react';
import { Slot } from '@radix-ui/react-slot';
import { cva, type VariantProps } from 'class-variance-authority';

import { cn } from './lib/utils';

const buttonVariants = cva(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function FormInputItem({
placeholder={t(placeholder)}
type={type ?? 'text'}
className={cn(
'bg-gray-100 text-gray-950 p-2 rounded-md'
'bg-gray-100 text-gray-950 p-2 rounded-md outline-0 focus:border-blue-400 focus:border-2'
)}
/>
)}
Expand Down
2 changes: 1 addition & 1 deletion apps/desk/src/renderer/src/components/ui/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
type={type}
value={value}
className={cn(
'flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
'flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',
className
)}
ref={ref}
Expand Down
2 changes: 1 addition & 1 deletion apps/desk/src/renderer/src/components/ui/main-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function MainSelect({
{t(label)} {required && <span className="text-red-500">*</span>}
</p>
<Select onValueChange={onChange} value={value}>
<SelectTrigger className="bg-gray-100 text-gray-950 h-10 rounded-md">
<SelectTrigger className="bg-gray-100 text-gray-950 h-10 rounded-md focus:ring-0 focus:border-blue-400">
<SelectValue placeholder={placeholder} />
</SelectTrigger>
<SelectContent className="bg-white text-gray-950 rounded-md">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function PhoneInputItem({
defaultCountry={defaultValue}
value={value}
onChange={onChange}
className="w-full h-10 bg-gray-100 text-gray-950 border border-input rounded-md flex rtl:flex-row-reverse"
className="w-full h-10 bg-gray-100 text-gray-950 border rounded-md flex rtl:flex-row-reverse"
inputStyle={{
width: '100%',
direction: 'ltr',
Expand Down
5 changes: 3 additions & 2 deletions apps/desk/src/renderer/src/containers/groups-listing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import { Loading } from './laoding';

const GroupListing: React.FC = () => {
const url = new URLSearchParams(window.location.search);

const themId = url.get('themeId');

const organizationId = url.get('organizationId');

const { data, isLoading, isError, isSuccess } = useGetAllGroups(
themId || '',
organizationId || ''
organizationId || '',
);


if (isLoading) {
return <Loading />;
}
Expand Down
4 changes: 2 additions & 2 deletions apps/desk/src/renderer/src/containers/laoding.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { FaSpinner } from 'react-icons/fa';
import { CgSpinner } from 'react-icons/cg';

export const Loading = () => {
return (
<div className="flex items-center justify-center h-screen w-full">
<FaSpinner className="animate-spin" size={80} />
<CgSpinner className="animate-spin text-blue-600" size={80} />
</div>
);
};
2 changes: 1 addition & 1 deletion apps/desk/src/renderer/src/containers/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useGetMe } from '@renderer/hooks/api/user/me';
import { Loading } from './laoding';

const ProfilePage = (): JSX.Element => {
const { data, isLoading, isError, error, isSuccess, refetch } = useGetMe();
const { data, isLoading, isError, error, isSuccess } = useGetMe();

if (isLoading) {
return <Loading />;
Expand Down
1 change: 0 additions & 1 deletion apps/desk/src/renderer/src/hooks/api/user/useUpdateUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { AxiosResponse } from 'axios';
import { toast } from 'react-toastify';
import { User } from './me';
import { setUserData } from '@renderer/store/slices/auth.slice';
import { da } from 'date-fns/locale';

export interface UpdateUserParams {
userId: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,15 @@ export default function useHandelEditFormation(
const { id, ...values } = defaultValues;
return !areObjectsEqual(data, values);
}
return false
return false;
};

const [openUnsavedChange, setOpenUnsavedChange] = useState(false);

return {
openUnsavedChange,
setOpenUnsavedChange,
isPending: createMuation.isPending || updateMuation.isPending,
methods,
handleSubmit,
handleUnsavedChange,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ export default function useHandelEditGroup(
// check if there is an empty field
if (defaultValues && crud == 'edit') {
const { id, date, ...values } = defaultValues;
console.log('data : ', data);
console.log('defaultValues jjjj: ', values);
return JSON.stringify(data) !== JSON.stringify(values);
}
return false;
Expand All @@ -77,4 +75,4 @@ export default function useHandelEditGroup(
handleSubmit,
handleUnsavedChange,
};
}
}
Loading