@imj_media/tareas 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/.env.template +8 -0
  2. package/.storybook/main.ts +26 -0
  3. package/.storybook/preview.ts +15 -0
  4. package/LICENSE.md +21 -0
  5. package/README.md +50 -0
  6. package/core/actions/get_all_users.action.ts +16 -0
  7. package/core/actions/get_salesman_response.action.ts +16 -0
  8. package/core/actions/get_tasks_project.action.ts +62 -0
  9. package/core/actions/get_tasks_response.action.ts +56 -0
  10. package/eslint.config.js +28 -0
  11. package/global.d.ts +3 -0
  12. package/infraestructure/interfaces/salesmans-obp-response.ts +43 -0
  13. package/infraestructure/interfaces/salesmans-obp.ts +4 -0
  14. package/infraestructure/interfaces/tasks-campania-response.ts +118 -0
  15. package/infraestructure/interfaces/tasks-campania.ts +26 -0
  16. package/infraestructure/interfaces/tasks-kanban-general.ts +25 -0
  17. package/infraestructure/interfaces/tasks-reponse.ts +111 -0
  18. package/infraestructure/interfaces/teams-response.ts +7 -0
  19. package/infraestructure/interfaces/teams.ts +5 -0
  20. package/infraestructure/interfaces/users-obp-response.ts +52 -0
  21. package/infraestructure/interfaces/users.ts +5 -0
  22. package/infraestructure/mappers/all-users-obp.ts +12 -0
  23. package/infraestructure/mappers/campaign-tasks.ts +35 -0
  24. package/infraestructure/mappers/kanban-tasks.ts +35 -0
  25. package/infraestructure/mappers/salesmans-obp.ts +11 -0
  26. package/infraestructure/mappers/teams.ts +12 -0
  27. package/package.json +61 -0
  28. package/postcss.config.js +6 -0
  29. package/src/components/atoms/Avatar.tsx +14 -0
  30. package/src/components/atoms/Comment.tsx +33 -0
  31. package/src/components/atoms/InputSearch.tsx +40 -0
  32. package/src/components/atoms/SkeletonCard.tsx +17 -0
  33. package/src/components/atoms/TabButton.tsx +16 -0
  34. package/src/components/atoms/TooltipUser.tsx +26 -0
  35. package/src/components/atoms/index.ts +2 -0
  36. package/src/components/index.ts +3 -0
  37. package/src/components/kanban-campania/DoneBoard.tsx +12 -0
  38. package/src/components/kanban-campania/KanbanCampania.tsx +39 -0
  39. package/src/components/kanban-campania/ToDoBoard.tsx +12 -0
  40. package/src/components/kanban-campania/WorkingBoard.tsx +13 -0
  41. package/src/components/kanban-campania/filters.ts +46 -0
  42. package/src/components/kanban-campania/index.ts +3 -0
  43. package/src/components/kanban-general/DoneBoard.tsx +12 -0
  44. package/src/components/kanban-general/KanbanGeneral.tsx +40 -0
  45. package/src/components/kanban-general/ToDoBoard.tsx +12 -0
  46. package/src/components/kanban-general/WorkingBoard.tsx +13 -0
  47. package/src/components/kanban-general/filters.ts +58 -0
  48. package/src/components/kanban-general/index.ts +3 -0
  49. package/src/components/layout/FilterButton.tsx +50 -0
  50. package/src/components/layout/FilterContent.tsx +70 -0
  51. package/src/components/layout/IndexComponents.tsx +32 -0
  52. package/src/components/lista-campania/ChildTask.tsx +22 -0
  53. package/src/components/lista-campania/Date.tsx +30 -0
  54. package/src/components/lista-campania/ListaCampania.tsx +21 -0
  55. package/src/components/lista-campania/ParentTask.tsx +57 -0
  56. package/src/components/molecules/AllComments.tsx +78 -0
  57. package/src/components/molecules/ButtonAssignUsers.tsx +175 -0
  58. package/src/components/molecules/DependentTasks.tsx +64 -0
  59. package/src/components/molecules/Tabs.tsx +39 -0
  60. package/src/components/molecules/index.ts +1 -0
  61. package/src/components/organisms/Board.tsx +87 -0
  62. package/src/components/organisms/Checkbox.tsx +45 -0
  63. package/src/components/organisms/DetailsTask.tsx +286 -0
  64. package/src/components/organisms/TabDetailsTask.tsx +39 -0
  65. package/src/components/organisms/Task.tsx +176 -0
  66. package/src/components/organisms/index.ts +2 -0
  67. package/src/components/tasks/PriorityButton.tsx +79 -0
  68. package/src/components/templates/Layout.tsx +84 -0
  69. package/src/components/templates/TableList/components/TableList.scss +270 -0
  70. package/src/components/templates/TableList/components/TableList.tsx +239 -0
  71. package/src/components/templates/TableList/components/index.tsx +1 -0
  72. package/src/constants/colors.ts +64 -0
  73. package/src/constants/gaps.ts +8 -0
  74. package/src/constants/paddings.ts +8 -0
  75. package/src/constants/shadows.ts +5 -0
  76. package/src/context/filtersLayout.context.tsx +118 -0
  77. package/src/context/kanbanCampania.context.tsx +50 -0
  78. package/src/context/useApis.context.tsx +47 -0
  79. package/src/context/userLog.context.tsx +50 -0
  80. package/src/env.d.ts +10 -0
  81. package/src/functions/taskCalculations.tsx +818 -0
  82. package/src/hooks/useAllUsers.ts +18 -0
  83. package/src/hooks/useCheckTask.tsx +15 -0
  84. package/src/hooks/useComerciales.ts +58 -0
  85. package/src/hooks/useDoneTasks.ts +90 -0
  86. package/src/hooks/useElementPosition.ts +34 -0
  87. package/src/hooks/useFunctionsTasks.ts +57 -0
  88. package/src/hooks/useNormalizedData.ts +36 -0
  89. package/src/hooks/useTeams.ts +19 -0
  90. package/src/hooks/useToDoTasks.ts +89 -0
  91. package/src/hooks/useWorkingTasks.ts +85 -0
  92. package/src/index.css +55 -0
  93. package/src/index.ts +2 -0
  94. package/src/index.tsx +1 -0
  95. package/src/pages/App.tsx +42 -0
  96. package/src/pages/NoAccessToken.tsx +20 -0
  97. package/src/pages/NoUser.tsx +20 -0
  98. package/src/stories/AppTasks.stories.tsx +36 -0
  99. package/src/stories/Table.stories.tsx +160 -0
  100. package/src/types/index.ts +107 -0
  101. package/src/types/interfaces.ts +67 -0
  102. package/src/types/layout.types.ts +30 -0
  103. package/src/utils/filters.functions.ts +17 -0
  104. package/src/utils/formats.ts +33 -0
  105. package/src/utils/functionsStorybook.tsx +0 -0
  106. package/src/utils/inputs.functions.ts +25 -0
  107. package/src/utils/tanstack.functions.ts +19 -0
  108. package/src/utils/utils.ts +12 -0
  109. package/src/vite-env.d.ts +1 -0
  110. package/tailwind.config.js +31 -0
  111. package/tsconfig.app.json +26 -0
  112. package/tsconfig.json +7 -0
  113. package/tsconfig.node.json +24 -0
  114. package/vite.config.ts +16 -0
@@ -0,0 +1,36 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import AppTasks from '../pages/App';
3
+ const meta: Meta<typeof AppTasks> = {
4
+ title: 'AppTasks',
5
+ component: AppTasks,
6
+ };
7
+
8
+ export default meta;
9
+
10
+ type Story = StoryObj<typeof meta>;
11
+
12
+ export const Default: Story = {
13
+ args: {
14
+ path: "kanban-campania",
15
+ user:{
16
+ id: 320,
17
+ // This access token is for testing purposes only
18
+
19
+ accessToken:
20
+ // access Token dev
21
+ "35e8e0205c85c548d1a0a5a8500b459162c9b13a02db5cb1522acbde9578fe6013256f1e86e375d18ab68600790cdbe4e5e81d5a96daa0ef54f99c646acd13a62c562dd9eeff8cefd188af54b4b3950d2319d5579342e9ce25ded6a6e399adf2b6dcf8e8e1efee8d11bcbdbeb9674707952162a17693009126ac36c2e66c968c"
22
+
23
+ // access Token prod
24
+ // "a0c8c98cab6f7055d2c7b98e9a27f359dc027c0a3f01011cd11e3792321c9dcfff88b89c76e4e90a8dc74f52028a1c974112daa4e2bf5531489fea182bf54d310d745e0eaaeb1a1769341f851d256c6b92c74853ab308dfb67c52be7d9de94a4846be17b9b66ff37e6cf5243874718756daa86fef56b8afc31374eae35d329d7"
25
+ },
26
+ env: "dev"
27
+ },
28
+
29
+ name:"AppTasks",
30
+ render: (args) => {
31
+ return (
32
+ <div className='h-[80vh] w-[90vw] overflow-y-hidden'>
33
+ <AppTasks {...args} />
34
+ </div>
35
+ )},
36
+ };
@@ -0,0 +1,160 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import TableList from '../components/templates/TableList/components/TableList';
3
+
4
+ // Definir el tipo para los datos
5
+ type DataType = {
6
+ nameCampania: string;
7
+ FirstDate: string;
8
+ EndDate: string;
9
+ Status: number;
10
+ Responsable: { name: string };
11
+ };
12
+
13
+ // Define el meta con el tipo genérico
14
+ const meta: Meta<typeof TableList<DataType>> = {
15
+ title: 'AppTasks/Components/Table',
16
+ component: TableList,
17
+ parameters: {
18
+ layout: 'centered',
19
+ },
20
+ } satisfies Meta<typeof TableList<DataType>>;
21
+
22
+ export default meta;
23
+
24
+ // Define el tipo Story
25
+ type Story = StoryObj<typeof meta>;
26
+
27
+ // Define la historia Default
28
+ export const Table: Story = {
29
+ args: {
30
+ data: [
31
+ {
32
+ nameCampania: 'AR-0226-TEST-TEST_TODOS_RENE-OCT-2024',
33
+ FirstDate: '2024-11-20T12:00:00Z',
34
+ EndDate: '2024-11-20T12:00:00Z',
35
+ Status: 30,
36
+ Responsable: { name: 'Maria Ayala' },
37
+ },
38
+ {
39
+ nameCampania: 'AR-0226-TEST-TEST_TODOS_RENE-OCT-2024',
40
+ FirstDate: '2024-11-20T12:00:00Z',
41
+ EndDate: '2024-11-20T12:00:00Z',
42
+ Status: 100,
43
+ Responsable: { name: 'Juan Pérez' },
44
+ },
45
+ {
46
+ nameCampania: 'AR-0226-TEST-TEST_TODOS_RENE-OCT-2024',
47
+ FirstDate: '2024-11-20T12:00:00Z',
48
+ EndDate: '2024-11-20T12:00:00Z',
49
+ Status: 70,
50
+ Responsable: { name: 'Juan Camaney' },
51
+ },
52
+ {
53
+ nameCampania: 'AR-0226-TEST-TEST_TODOS_RENE-OCT-2024',
54
+ FirstDate: '2024-11-20T12:00:00Z',
55
+ EndDate: '2024-11-20T12:00:00Z',
56
+ Status: 0,
57
+ Responsable: { name: 'Juan Pérez' },
58
+ },
59
+ {
60
+ nameCampania: 'AR-0226-TEST-TEST_TODOS_RENE-OCT-2024',
61
+ FirstDate: '2024-11-20T12:00:00Z',
62
+ EndDate: '2024-11-20T12:00:00Z',
63
+ Status: 50,
64
+ Responsable: { name: 'Maria Ayala' },
65
+ },
66
+ {
67
+ nameCampania: 'AR-0226-TEST-TEST_TODOS_RENE-OCT-2024',
68
+ FirstDate: '2024-11-20T12:00:00Z',
69
+ EndDate: '2024-11-20T12:00:00Z',
70
+ Status: 85,
71
+ Responsable: { name: 'Juan Pérez' },
72
+ },
73
+ {
74
+ nameCampania: 'AR-0226-TEST-TEST_TODOS_RENE-OCT-2024',
75
+ FirstDate: '2024-11-20T12:00:00Z',
76
+ EndDate: '2024-11-20T12:00:00Z',
77
+ Status: 70,
78
+ Responsable: { name: 'Maria Ayala' },
79
+ },
80
+ {
81
+ nameCampania: 'AR-0226-TEST-TEST_TODOS_RENE-OCT-2024',
82
+ FirstDate: '2024-11-20T12:00:00Z',
83
+ EndDate: '2024-11-20T12:00:00Z',
84
+ Status: 85,
85
+ Responsable: { name: 'Juan Pérez' },
86
+ },
87
+ {
88
+ nameCampania: 'AR-0226-TEST-TEST_TODOS_RENE-OCT-2024',
89
+ FirstDate: '2024-11-20T12:00:00Z',
90
+ EndDate: '2024-11-20T12:00:00Z',
91
+ Status: 70,
92
+ Responsable: { name: 'Maria Ayala' },
93
+ },
94
+ {
95
+ nameCampania: 'AR-0226-TEST-TEST_TODOS_RENE-OCT-2024',
96
+ FirstDate: '2024-11-20T12:00:00Z',
97
+ EndDate: '2024-11-20T12:00:00Z',
98
+ Status: 85,
99
+ Responsable: { name: 'Juan Pérez' },
100
+ },
101
+ {
102
+ nameCampania: 'AR-0226-TEST-TEST_TODOS_RENE-OCT-2024',
103
+ FirstDate: '2024-11-20T12:00:00Z',
104
+ EndDate: '2024-11-20T12:00:00Z',
105
+ Status: 70,
106
+ Responsable: { name: 'Maria Ayala' },
107
+ },
108
+ {
109
+ nameCampania: 'AR-0226-TEST-TEST_TODOS_RENE-OCT-2024',
110
+ FirstDate: '2024-11-20T12:00:00Z',
111
+ EndDate: '2024-11-20T12:00:00Z',
112
+ Status: 85,
113
+ Responsable: { name: 'Juan Pérez' },
114
+ },
115
+ {
116
+ nameCampania: 'AR-0226-TEST-TEST_TODOS_RENE-OCT-2024',
117
+ FirstDate: '2024-11-20T12:00:00Z',
118
+ EndDate: '2024-11-20T12:00:00Z',
119
+ Status: 70,
120
+ Responsable: { name: 'Maria Ayala' },
121
+ },
122
+ {
123
+ nameCampania: 'AR-0226-TEST-TEST_TODOS_RENE-OCT-2024',
124
+ FirstDate: '2024-11-20T12:00:00Z',
125
+ EndDate: '2024-11-20T12:00:00Z',
126
+ Status: 85,
127
+ Responsable: { name: 'Juan Pérez' },
128
+ },
129
+ ],
130
+ columns: [
131
+ {
132
+ header: 'Campaña',
133
+ accessor: 'nameCampania',
134
+ type: 'text', // Especificar el tipo de dato
135
+ },
136
+ {
137
+ header: 'Fecha de inicio',
138
+ accessor: 'FirstDate',
139
+ type: 'date', // Especificar que se trata de una fecha
140
+ },
141
+ {
142
+ header: 'Fecha de fin',
143
+ accessor: 'EndDate',
144
+ type: 'date', // Especificar que se trata de una fecha
145
+ },
146
+ {
147
+ header: 'Progreso',
148
+ accessor: 'Status',
149
+ type: 'progress', // Especificar que es un progreso
150
+ },
151
+ {
152
+ header: 'Responsable',
153
+ accessor: 'Responsable',
154
+ type: 'avatar', // Especificar que se trata de un avatar
155
+ },
156
+ ],
157
+ showPagination: true,
158
+ pageSize: 9,
159
+ },
160
+ };
@@ -0,0 +1,107 @@
1
+ type TeamWork = {
2
+ id: number;
3
+ nombre: string;
4
+ miembros: string[];
5
+ };
6
+
7
+ type TRequirement = {
8
+ id: number;
9
+ texto_corto: string;
10
+ };
11
+
12
+ type ImageType = {
13
+ formats: {
14
+ large: {
15
+ url: string;
16
+ };
17
+ medium: {
18
+ url: string;
19
+ };
20
+ small: {
21
+ url: string;
22
+ };
23
+ thumbnail: {
24
+ url: string;
25
+ };
26
+ };
27
+ };
28
+
29
+ type Responsible = {
30
+ id: number;
31
+ email: string;
32
+ nombre: string;
33
+ imagen: ImageType;
34
+ };
35
+
36
+ type CommentItem = {
37
+ id: number;
38
+ comentario: string;
39
+ createdAt: Date | null;
40
+ updatedAt: Date | null;
41
+ autor: {
42
+ id: number;
43
+ email: string;
44
+ nombre: string;
45
+ imagen: ImageType;
46
+ };
47
+ };
48
+
49
+ type CommentProps = {
50
+ comment: CommentItem;
51
+ };
52
+
53
+ type CommentsProps = {
54
+ data: any;
55
+ currentUser: any;
56
+ taskId: number;
57
+ onNewComment: (addCommentF: boolean) => void;
58
+ };
59
+
60
+ type DetailsTaskData = {
61
+ descripcion: string;
62
+ estado: string;
63
+ comentarios: [];
64
+ campania: string;
65
+ createdAt: Date | null;
66
+ updatedAt: Date | null;
67
+ equipo: TeamWork;
68
+ nombre_medio: string;
69
+ ffin: Date | null;
70
+ finicio: Date | null;
71
+ f_inicio_estimada: Date | null;
72
+ f_fin_estimada: Date | null;
73
+ fterminada: Date | null;
74
+ responsable: Responsible | null;
75
+ prioridad: string | null;
76
+ lista: string | null;
77
+ texto_corto: string | null;
78
+ texto_largo: string | null;
79
+ id_t_requerida: TRequirement;
80
+ ids_t_dependientes: TRequirement[];
81
+ };
82
+
83
+ type DetailsTaskProps = {
84
+ isOpen: boolean;
85
+ taskId: number;
86
+ setIsOpen: (isOpen: boolean) => void;
87
+ };
88
+
89
+ type TabDetailsTaskItem = {
90
+ id: number;
91
+ label: string;
92
+ component: React.ReactNode;
93
+ };
94
+
95
+ type TabDetailsTaskProps = {
96
+ items: TabDetailsTaskItem[];
97
+ };
98
+
99
+ export type {
100
+ DetailsTaskData,
101
+ DetailsTaskProps,
102
+ TabDetailsTaskProps,
103
+ TabDetailsTaskItem,
104
+ CommentsProps,
105
+ CommentItem,
106
+ CommentProps,
107
+ };
@@ -0,0 +1,67 @@
1
+ import { TPaths } from "./layout.types";
2
+
3
+ interface IAvatar {
4
+ imageUrl?: string;
5
+ alt?: string;
6
+ }
7
+
8
+ interface IPaths {
9
+ path: TPaths,
10
+ }
11
+
12
+ interface IUser {
13
+ id: number;
14
+ userName: string;
15
+ image?: string | null;
16
+ }
17
+
18
+ interface IComment {
19
+ id: number;
20
+ comment: string;
21
+ }
22
+
23
+ interface ITask {
24
+ id: number;
25
+ texto_corto: string;
26
+ texto_largo?: string;
27
+ finicio?: string;
28
+ ffin?: string;
29
+ nivel_dificultad?: number;
30
+ estatus?: number;
31
+ orden?: number;
32
+ comments?: IComment[];
33
+ }
34
+
35
+ interface ICampaignTask {
36
+ idruta?: number;
37
+ idmedio?: number;
38
+ idindoor?: number;
39
+ idvalla?: number;
40
+ id_detallepauta?: number;
41
+ tipo_tarea?: number;
42
+ es_pausable?: boolean;
43
+ repeticiones_realizadas?: number;
44
+ }
45
+
46
+ interface IProject {
47
+ nombre: string;
48
+ }
49
+
50
+ interface IProjectTask {
51
+ proyecto: IProject;
52
+ }
53
+
54
+
55
+ export type {
56
+ //* Atoms
57
+ IAvatar,
58
+
59
+ //* Molecules
60
+ IUser,
61
+
62
+ //* Organisms
63
+ ITask,
64
+ ICampaignTask,
65
+ IProjectTask,
66
+ IProject
67
+ };
@@ -0,0 +1,30 @@
1
+ type TPaths = "kanban-general" | "lista-campanias" | "kanban-campania";
2
+ type TTab = "kanban" | "lista" | "gantt";
3
+
4
+ //#region types para la generación de los componentes
5
+ interface IIndexComponents {
6
+ path: TPaths,
7
+ tab: TTab,
8
+ }
9
+ interface IComponents {
10
+ "kanban-general"?: IViews,
11
+ "lista-campanias"?: IViews,
12
+ "kanban-campania"?: IViews,
13
+ }
14
+ interface IViews {
15
+ kanban?: React.ReactNode;
16
+ lista?: React.ReactNode;
17
+ gantt?: React.ReactNode;
18
+ }
19
+ //#endregion
20
+
21
+ export type {
22
+ //paths
23
+ TTab,
24
+ TPaths,
25
+
26
+ //components
27
+ IIndexComponents,
28
+ IComponents,
29
+ IViews
30
+ }
@@ -0,0 +1,17 @@
1
+ import { TFilters } from "../context/filtersLayout.context";
2
+
3
+ export const addEstructureToFilters = (filters: TFilters)=>{
4
+ let newFilters:any = {};
5
+
6
+ Object.entries(filters).forEach(([key, value])=>{
7
+ if(key.includes(".")){
8
+ let [field, property] = key.split(".")
9
+ newFilters[field] = newFilters[field] || {}
10
+ newFilters[field][property] = value
11
+ } else {
12
+ newFilters[key] = value
13
+ }
14
+ })
15
+
16
+ return newFilters
17
+ }
@@ -0,0 +1,33 @@
1
+ import { IUsers } from "../../infraestructure/interfaces/users"
2
+
3
+ export const getMonthName = (month: number) => {
4
+ const monthName = new Intl.DateTimeFormat(
5
+ "es-MX",
6
+ {month: "long"}
7
+ ).format(month)
8
+
9
+ return monthName
10
+ }
11
+
12
+ function getDayNameInSpanishFromDate(date: Date) {
13
+ const daysOfWeek = ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'];
14
+ const dayIndex = new Date(date).getDay();
15
+ return daysOfWeek[dayIndex];
16
+ }
17
+
18
+ export const formatDate = (date: Date) => {
19
+ let day = date.getDate()
20
+ let month = getMonthName(date.getMonth()).slice(0, 3)
21
+ let year = date.getFullYear().toString().slice(-2)
22
+ let dayName = getDayNameInSpanishFromDate(date).slice(0, 3)
23
+ return `${dayName.charAt(0).toUpperCase() + dayName.slice(1)} ${day} ${month.charAt(0).toUpperCase() + month.slice(1)} ${year}`
24
+ }
25
+
26
+
27
+ export const AddOBPUrl = (user: IUsers) => {
28
+ let url = "https://devobp.imjmedia.com.mx" ?? "https://obp.imjmedia.com.mx"
29
+ return {
30
+ ...user,
31
+ image: user.image ? `${url}${user.image}` : ''
32
+ }
33
+ }
File without changes
@@ -0,0 +1,25 @@
1
+ //* this function is a debounce function that can be used to debounce a function and delay the execution of the function
2
+ export function debounce(callback: (...args: any[]) => void, delay = 300, options = { leading: false, trailing: true }) {
3
+ let timer: NodeJS.Timeout;
4
+ let lastCallTime: number | null = null;
5
+
6
+ return function (...args: any[]) {
7
+ const now = Date.now();
8
+ const invokeLeading = options.leading && !lastCallTime;
9
+
10
+ clearTimeout(timer);
11
+
12
+ if (invokeLeading) {
13
+ callback(...args);
14
+ }
15
+
16
+ lastCallTime = now;
17
+
18
+ timer = setTimeout(() => {
19
+ if (options.trailing && (!options.leading || now - lastCallTime! >= delay)) {
20
+ callback(...args);
21
+ lastCallTime = null;
22
+ }
23
+ }, delay);
24
+ };
25
+ }
@@ -0,0 +1,19 @@
1
+ export const fetchNextPage = (key: any) => {
2
+ if (key?.hasNextPage) {
3
+ // Get the last page's data from key data
4
+ const lastPage = key?.data?.pages[key.data.pages.length - 1];
5
+
6
+ // Check if the length of the last page is equal to the expected page size (e.g., 30)
7
+ if (lastPage?.length === 30) {
8
+ key?.fetchNextPage(); // Fetch the next page
9
+ }
10
+ }
11
+ };
12
+
13
+ export const getPaginationEstructure = (page:number)=>({
14
+ pagination:{
15
+ page: page,
16
+ pageSize: 30,
17
+ withCount: true
18
+ }
19
+ })
@@ -0,0 +1,12 @@
1
+ export const URL_API = 'https://devobp.imjmedia.com.mx';
2
+
3
+ export function getInitials(name: string | undefined): string {
4
+ if (!name) return '';
5
+ const words = name.split(' ');
6
+ const firstTwoInitials = words
7
+ .map((word) => word[0]?.toUpperCase())
8
+ .slice(0, 2)
9
+ .join('');
10
+
11
+ return firstTwoInitials;
12
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,31 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+
3
+ import { COLORS } from './src/constants/colors';
4
+ import { GAPS } from './src/constants/gaps';
5
+ import { PADDINGS } from './src/constants/paddings';
6
+ import { SHADOWS } from './src/constants/shadows';
7
+
8
+ export default {
9
+ content: [
10
+ "./src/components/**/*.{js,ts,jsx,tsx}",
11
+ "./src/**/*.{js,ts,jsx,tsx}",
12
+ ],
13
+ darkMode: ["selector", "[data-mode='dark']"],
14
+ theme: {
15
+ extend: {
16
+ colors: COLORS,
17
+ boxShadow:SHADOWS,
18
+ gap:GAPS,
19
+ padding:PADDINGS,
20
+
21
+ fontFamily: {
22
+ // "sans-italic": ["OpenSans-Italic-VariableFont_wdth,wght", "sans-serif"],
23
+ // "sans-regular": ["OpenSans-VariableFont_wdth,wght", "sans-serif"],
24
+ }
25
+ },
26
+ },
27
+ plugins: [
28
+ require('@tailwindcss/line-clamp'),
29
+ ],
30
+ }
31
+
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "incremental": true,
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
+ "target": "ES2020",
6
+ "useDefineForClassFields": true,
7
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
8
+ "module": "ESNext",
9
+ "skipLibCheck": true,
10
+
11
+ /* Bundler mode sds */
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "isolatedModules": true,
15
+ "moduleDetection": "force",
16
+ "noEmit": true,
17
+ "jsx": "react-jsx",
18
+
19
+ /* Linting */
20
+ "strict": true,
21
+ "noUnusedLocals": true,
22
+ "noUnusedParameters": true,
23
+ "noFallthroughCasesInSwitch": true
24
+ },
25
+ "include": ["src"]
26
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ { "path": "./tsconfig.app.json" },
5
+ { "path": "./tsconfig.node.json" }
6
+ ]
7
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "incremental": true,
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
5
+ "target": "ES2022",
6
+ "lib": ["ES2023"],
7
+ "module": "ESNext",
8
+ "skipLibCheck": true,
9
+
10
+ /* Bundler mode */
11
+ "moduleResolution": "bundler",
12
+ "allowImportingTsExtensions": true,
13
+ "isolatedModules": true,
14
+ "moduleDetection": "force",
15
+ "noEmit": true,
16
+
17
+ /* Linting */
18
+ "strict": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "noFallthroughCasesInSwitch": true
22
+ },
23
+ "include": ["vite.config.ts"]
24
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { resolve } from 'path';
2
+ import { defineConfig } from 'vite';
3
+ import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
4
+ import react from '@vitejs/plugin-react';
5
+
6
+ export default defineConfig({
7
+ build: {
8
+ lib: {
9
+ entry: resolve('src', 'index.ts'),
10
+ name: 'tareas',
11
+ formats: ['es', 'cjs'],
12
+ fileName: (format: string) => `tareas.${format === 'cjs' ? 'cjs' : 'es.js'}`,
13
+ }
14
+ },
15
+ plugins: [cssInjectedByJsPlugin() as any, react() as any],
16
+ });