@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,18 @@
1
+ import { useQuery } from "@tanstack/react-query"
2
+ import { useApis } from "../context/useApis.context"
3
+ import { getAllUSersResponse } from "../../core/actions/get_all_users.action"
4
+
5
+ const useAllUsers = () => {
6
+ const {tasks_api} = useApis();
7
+ const users = useQuery({
8
+ queryKey: ["users"],
9
+ queryFn: ()=>getAllUSersResponse({tasks_api}),
10
+ staleTime: 1000 * 60 * 60 * 24,
11
+ })
12
+
13
+ return {
14
+ users
15
+ }
16
+ }
17
+
18
+ export default useAllUsers
@@ -0,0 +1,15 @@
1
+ import { useState } from 'react'
2
+
3
+ const useCheckTask = ({id}: {id: number}) => {
4
+ const [checked, setChecked] = useState(false);
5
+
6
+ //TODO: Implementar la funcionalidad de completar tarea
7
+ const checkTask = ()=> {
8
+ setChecked(!checked)
9
+ console.log("completar tarea", id)
10
+ }
11
+
12
+ return { checked, checkTask }
13
+ }
14
+
15
+ export default useCheckTask
@@ -0,0 +1,58 @@
1
+ import { useFiltersLayoutContext } from '../context/filtersLayout.context'
2
+ import { useApis } from '../context/useApis.context'
3
+ import { useUser } from '../context/userLog.context'
4
+ import { SalesmanUsersMapper } from '../../infraestructure/mappers/salesmans-obp'
5
+ const useSalesmanUsers = () => {
6
+ const {tasks_api} = useApis()
7
+ const {filters} = useFiltersLayoutContext()
8
+ const {user} = useUser()
9
+
10
+ const getSalesmans = async () => {
11
+ const response = await tasks_api.get("/api/obtener-comerciales")
12
+ return response.data.map(SalesmanUsersMapper.toSalesmanUsers)
13
+ }
14
+
15
+ const getProjects = async () => {
16
+ const response = await tasks_api.get("/api/listado_tareas",{
17
+ params: {
18
+ ...filters,
19
+ owner:{
20
+ user: user.id,
21
+ config: filters?.owner?.config ?? "yo_y_mis_equipos"
22
+ },
23
+ justProjects: true,
24
+ }
25
+ })
26
+ return response.data.map(SalesmanUsersMapper.toSalesmanUsers)
27
+ }
28
+
29
+ const getSalesmanAndProjects = async () => {
30
+ const [salesmanUsers, projects] = await Promise.all([
31
+ tasks_api.get("/api/obtener-comerciales"),
32
+ tasks_api.get("/api/listado_tareas",{
33
+ params: {
34
+ ...filters,
35
+ owner:{
36
+ user: user.id,
37
+ config: filters?.owner?.config ?? "yo_y_mis_equipos"
38
+ },
39
+ justProjects: true,
40
+ }
41
+ }),
42
+ ])
43
+
44
+ return {
45
+ salesmanUsers: salesmanUsers.data.map(SalesmanUsersMapper.toSalesmanUsers),
46
+ projects: projects.data.map(SalesmanUsersMapper.toSalesmanUsers),
47
+ }
48
+ }
49
+
50
+ return {
51
+ //methods
52
+ getSalesmanAndProjects,
53
+ getProjects,
54
+ getSalesmans,
55
+ }
56
+ }
57
+
58
+ export default useSalesmanUsers
@@ -0,0 +1,90 @@
1
+ import { useInfiniteQuery, useQueryClient } from '@tanstack/react-query'
2
+ import { getTasksResponse } from '../../core/actions/get_tasks_response.action'
3
+ import { getPaginationEstructure } from '../utils/tanstack.functions'
4
+ import { useEffect, useState } from 'react'
5
+ import { useApis } from '../context/useApis.context'
6
+ import { useUser } from '../context/userLog.context'
7
+ import { useFiltersLayoutContext } from '../context/filtersLayout.context'
8
+
9
+ const useDoneTasks = () => {
10
+
11
+ const queryClient = useQueryClient();
12
+
13
+ //* Contexts
14
+ const {user} = useUser()
15
+ const {tasks_api}= useApis()
16
+ const {filters} = useFiltersLayoutContext() as any;
17
+
18
+ //* States
19
+ const [total, setTotal] = useState(0)
20
+ const [filtersToSend, setFiltersToSend] = useState({
21
+ owner:{
22
+ user: user.id,
23
+ config: filters?.owner?.config ?? "yo_y_mis_equipos"
24
+ },
25
+ status: "completadas",
26
+ });
27
+
28
+ //* this is the query to get the done tasks in infinite query
29
+ const doneTasks = useInfiniteQuery({
30
+ initialPageParam: 1,
31
+ queryKey: ["done_tasks", filtersToSend],
32
+ queryFn: ({pageParam})=> getTasksResponse({
33
+ filters: {
34
+ ...filtersToSend,
35
+ status: "completadas",
36
+ ...getPaginationEstructure(pageParam)
37
+ },
38
+ tasks_api,
39
+ page: pageParam,
40
+ }),
41
+ staleTime: 1000 * 60 * 60 * 24, // mantains the data for 24 hours
42
+ getNextPageParam:(_lastPage, pages)=> {
43
+ return pages.length + 1
44
+ },
45
+ })
46
+
47
+ //* this set the filters to send to the query
48
+ useEffect(()=>{
49
+ if(Object.keys(filters).length > 0){
50
+ setFiltersToSend({
51
+ ...filters,
52
+ owner:{
53
+ user: user.id,
54
+ config: filters?.owner?.config ?? "yo_y_mis_equipos"
55
+ },
56
+ status: "completadas",
57
+ })
58
+ }
59
+ },[filters])
60
+
61
+ //* this invalidate the query when the filtersToSend changes
62
+ useEffect(() => {
63
+ queryClient.invalidateQueries({
64
+ queryKey: ["done_tasks", filtersToSend]
65
+ });
66
+ }, [filtersToSend]);
67
+
68
+ //* this is the query to get the count of the done tasks
69
+ useEffect(()=>{
70
+ const getCount = async () => {
71
+ const response = await tasks_api.get("/api/listado_tareas",{ params: {
72
+ ...filtersToSend,
73
+ status: "completadas",
74
+ ...getPaginationEstructure(1),
75
+ justCount: true,
76
+ tasks_api
77
+ } })
78
+ setTotal(response.data.total)
79
+ }
80
+ getCount()
81
+ },[doneTasks?.data, filtersToSend])
82
+
83
+ return {
84
+ // Properties
85
+ doneTasks,
86
+ total
87
+ }
88
+ }
89
+
90
+ export default useDoneTasks
@@ -0,0 +1,34 @@
1
+ import { useState } from 'react'
2
+
3
+ const useElementPosition = () => {
4
+ const [position, setPosition] = useState<{x:number,y:number}|null>(null);
5
+
6
+ const getChildrenSize = (e:React.MutableRefObject<HTMLElement>)=>{
7
+ return e.current?.getBoundingClientRect()
8
+ }
9
+
10
+ const setElementPosition = (e:React.MutableRefObject<HTMLElement>)=>{
11
+ let ElementPosition = e.current?.getBoundingClientRect();
12
+ let xPosition = ElementPosition?.x + ((ElementPosition?.width ?? 0));
13
+ let yPosition = ElementPosition?.y + ElementPosition?.height;
14
+
15
+ if(!position) setPosition({x: xPosition ?? 0,y:yPosition ?? 0})
16
+ else setPosition(null);
17
+ }
18
+
19
+ const clearPosition = ()=>{
20
+ setPosition(null)
21
+ }
22
+
23
+ return {
24
+ //Properties
25
+ position,
26
+
27
+ //Methods
28
+ setElementPosition,
29
+ getChildrenSize,
30
+ clearPosition
31
+ }
32
+ }
33
+
34
+ export default useElementPosition
@@ -0,0 +1,57 @@
1
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
2
+ import { useApis } from "../context/useApis.context";
3
+
4
+ const useFunctionsTasks = () => {
5
+ const {tasks_api} = useApis();
6
+ const queryClient = useQueryClient();
7
+ interface IUpdateTask {
8
+ id:number;
9
+ user:number;
10
+ data: TData;
11
+ }
12
+
13
+ interface TData {
14
+ [key:string]: string | number | null | boolean | Date | undefined
15
+ }
16
+
17
+ const updateElement = async ({newData, id}:{newData:TData, id:number})=>{
18
+ const response = await tasks_api.put(`/api/tareas/${id}`,{
19
+ data: newData
20
+ })
21
+ return response.data
22
+ }
23
+
24
+ const mutation = useMutation({
25
+ mutationFn: ({ newData, id }: { newData: TData; id: number }) =>
26
+ updateElement({ newData, id }),
27
+ onSuccess: () => {
28
+ queryClient.invalidateQueries({ queryKey: ['toDoTasks'] });
29
+ queryClient.invalidateQueries({ queryKey: ['inProgressTasks'] });
30
+ queryClient.invalidateQueries({ queryKey: ['doneTasks'] });
31
+ console.log('Task updated successfully!');
32
+ },
33
+ onError: (error) => {
34
+ console.error('Failed to update the task.', error);
35
+ },
36
+ });
37
+
38
+ const updateTask = async ({id,data, user}:IUpdateTask)=>{
39
+ let newData: TData = {
40
+ updated_at: new Date().toISOString(),
41
+ updated_by: user,
42
+ ...data
43
+ }
44
+
45
+ try{
46
+ await mutation.mutateAsync({newData, id})
47
+ } catch (error) {
48
+ console.error("Error updating the element:", error)
49
+ }
50
+ }
51
+ return {
52
+ //* Methods
53
+ updateTask
54
+ }
55
+ }
56
+
57
+ export default useFunctionsTasks
@@ -0,0 +1,36 @@
1
+ export const normalizeData = (data: any): any => {
2
+ const isObject = (data: any) => Object.prototype.toString.call(data) === '[object Object]';
3
+
4
+ const flatten = (data: any) => {
5
+ if (!data.attributes) return data;
6
+
7
+ return {
8
+ id: data.id,
9
+ ...data.attributes,
10
+ };
11
+ };
12
+
13
+ if (Array.isArray(data)) {
14
+ return data.map((item) => normalizeData(item));
15
+ }
16
+
17
+ if (isObject(data)) {
18
+ if (Array.isArray(data.data)) {
19
+ data = [...data.data];
20
+ } else if (isObject(data.data)) {
21
+ data = flatten({ ...data.data });
22
+ } else if (data.data === null) {
23
+ data = null;
24
+ } else {
25
+ data = flatten(data);
26
+ }
27
+
28
+ for (const key in data) {
29
+ data[key] = normalizeData(data[key]);
30
+ }
31
+
32
+ return data;
33
+ }
34
+
35
+ return data;
36
+ };
@@ -0,0 +1,19 @@
1
+ import { useQuery } from '@tanstack/react-query'
2
+ import { useApis } from '../context/useApis.context'
3
+ import { normalizeData } from './useNormalizedData';
4
+ import { TeamsMapper } from '../../infraestructure/mappers/teams';
5
+ const useTeams = () => {
6
+ const {tasks_api} = useApis();
7
+
8
+ const teams = useQuery({
9
+ queryKey: ["teams","all"],
10
+ queryFn: async ()=>{
11
+ const response = await tasks_api.get("/api/equipos");
12
+ return normalizeData(response.data).map(TeamsMapper.toDomain)
13
+ }
14
+ })
15
+
16
+ return {teams}
17
+ }
18
+
19
+ export default useTeams
@@ -0,0 +1,89 @@
1
+ import { useInfiniteQuery, useQueryClient } from '@tanstack/react-query'
2
+ import { getTasksResponse } from '../../core/actions/get_tasks_response.action'
3
+ import { getPaginationEstructure } from '../utils/tanstack.functions'
4
+ import { useEffect, useState } from 'react'
5
+ import { useApis } from '../context/useApis.context'
6
+ import { useUser } from '../context/userLog.context'
7
+ import { useFiltersLayoutContext } from '../context/filtersLayout.context'
8
+
9
+ const useToDoTasks = () => {
10
+ const queryClient = useQueryClient();
11
+ const { tasks_api } = useApis();
12
+ const { user } = useUser();
13
+ const {filters} = useFiltersLayoutContext() as any;
14
+ const [ total, setTotal ] = useState(0)
15
+ const [filtersToSend, setFiltersToSend] = useState({
16
+ owner:{
17
+ user: user.id,
18
+ config: filters?.owner?.config ?? "yo_y_mis_equipos"
19
+ },
20
+ status: "por_hacer",
21
+ });
22
+
23
+ //* this is the query to get the to do tasks in infinite query
24
+ const toDoTasks = useInfiniteQuery({
25
+ initialPageParam: 1,
26
+ queryKey: ["to_do_tasks", filtersToSend],
27
+ queryFn: ({pageParam})=> getTasksResponse({
28
+ filters: {
29
+ ...filtersToSend,
30
+ status: "por_hacer",
31
+ ...getPaginationEstructure(pageParam)
32
+ },
33
+ tasks_api,
34
+ page: pageParam,
35
+ }),
36
+ staleTime: 1000 * 60 * 60 * 24, // mantains the data for 24 hours
37
+ getNextPageParam:(_lastPage, pages)=> {
38
+ return pages.length + 1
39
+ },
40
+ })
41
+
42
+ //* this set the filters to send to the query
43
+ useEffect(()=>{
44
+ if(Object.keys(filters).length > 0){
45
+ setFiltersToSend({
46
+ ...filters,
47
+ owner:{
48
+ user: user.id,
49
+ config: filters?.owner?.config ?? "yo_y_mis_equipos"
50
+ },
51
+ status: "por_hacer",
52
+ })
53
+ }
54
+ },[filters])
55
+
56
+ //* this invalidate the query when the filtersToSend changes
57
+ useEffect(() => {
58
+ queryClient.invalidateQueries({
59
+ queryKey: ["to_do_tasks", filtersToSend]
60
+ });
61
+ }, [filtersToSend]);
62
+
63
+ //* this is the query to get the count of the to do tasks
64
+ useEffect(()=>{
65
+ const getCount = async () => {
66
+ const response = await tasks_api.get("/api/listado_tareas",{ params: {
67
+ ...filtersToSend,
68
+ status: "por_hacer",
69
+ ...getPaginationEstructure(1),
70
+ tasks_api,
71
+ justCount: true,
72
+ } })
73
+ setTotal(response.data.total)
74
+ }
75
+ getCount()
76
+ },[filtersToSend, toDoTasks?.data])
77
+
78
+
79
+
80
+
81
+
82
+ return {
83
+ //Properties
84
+ toDoTasks,
85
+ total
86
+ }
87
+ }
88
+
89
+ export default useToDoTasks
@@ -0,0 +1,85 @@
1
+ import { useInfiniteQuery, useQueryClient } from '@tanstack/react-query'
2
+ import { getTasksResponse } from '../../core/actions/get_tasks_response.action'
3
+ import { getPaginationEstructure } from '../utils/tanstack.functions'
4
+ import { useEffect, useState } from 'react'
5
+ import { useApis } from '../context/useApis.context'
6
+ import { useUser } from '../context/userLog.context'
7
+ import { useFiltersLayoutContext } from '../context/filtersLayout.context'
8
+
9
+ const useWorkingTasks = () => {
10
+ const queryClient = useQueryClient();
11
+ const {tasks_api}= useApis()
12
+ const {user} = useUser()
13
+ const {filters} = useFiltersLayoutContext() as any;
14
+ const [total, setTotal] = useState(0)
15
+ const [filtersToSend, setFiltersToSend] = useState({
16
+ owner:{
17
+ user: user.id,
18
+ config: filters?.owner?.config ?? "yo_y_mis_equipos"
19
+ },
20
+ status: "trabajando",
21
+ });
22
+
23
+ //* this is the query to get the working tasks in infinite query
24
+ const workingTasks = useInfiniteQuery({
25
+ initialPageParam: 1,
26
+ queryKey: ["working_tasks", filtersToSend],
27
+ queryFn: ({pageParam})=> getTasksResponse({
28
+ filters: {
29
+ ...filtersToSend,
30
+ status: "trabajando",
31
+ ...getPaginationEstructure(pageParam)
32
+ },
33
+ tasks_api,
34
+ page: pageParam,
35
+ }),
36
+ staleTime: 1000 * 60 * 60 * 24, // mantains the data for 24 hours
37
+ getNextPageParam:(_lastPage, pages)=> {
38
+ return pages.length + 1
39
+ },
40
+ })
41
+
42
+ //* this set the filters to send to the query
43
+ useEffect(()=>{
44
+ if(Object.keys(filters).length > 0){
45
+ setFiltersToSend({
46
+ ...filters,
47
+ owner:{
48
+ user: user.id,
49
+ config: filters?.owner?.config ?? "yo_y_mis_equipos"
50
+ },
51
+ status: "trabajando",
52
+ })
53
+ }
54
+ },[filters])
55
+
56
+ //* this invalidate the query when the filtersToSend changes
57
+ useEffect(() => {
58
+ queryClient.invalidateQueries({
59
+ queryKey: ["working_tasks", filtersToSend]
60
+ });
61
+ }, [filtersToSend]);
62
+
63
+ //* this is the query to get the count of the working tasks
64
+ useEffect(()=>{
65
+ const getCount = async () => {
66
+ const response = await tasks_api.get("/api/listado_tareas",{ params: {
67
+ ...filtersToSend,
68
+ status: "trabajando",
69
+ ...getPaginationEstructure(1),
70
+ tasks_api,
71
+ justCount: true,
72
+ } })
73
+ setTotal(response.data.total)
74
+ }
75
+ getCount()
76
+ },[filtersToSend, workingTasks?.data])
77
+
78
+ return {
79
+ //Properties
80
+ workingTasks,
81
+ total
82
+ }
83
+ }
84
+
85
+ export default useWorkingTasks
package/src/index.css ADDED
@@ -0,0 +1,55 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ :root {
6
+ --imj-bg: #efefef;
7
+ --imj-bg-content: #fafafa;
8
+ --imj-bg-card: #fafafa;
9
+ }
10
+
11
+ [theme='dark'] {
12
+ --imj-bg: #252525;
13
+ --imj-bg-content: #313131;
14
+ --imj-bg-card: #3d3d3d;
15
+ }
16
+
17
+ @layer components {
18
+ /* * Texts difining styles */
19
+ .title-text {
20
+ @apply text-base font-medium text-gray-700 text-ellipsis line-clamp-[1];
21
+ }
22
+ .subtitle-text {
23
+ @apply text-xs font-medium text-ellipsis line-clamp-[1] text-gray-500;
24
+ }
25
+ .content-text {
26
+ @apply text-xs font-medium text-ellipsis line-clamp-[1] text-gray-400;
27
+ }
28
+
29
+ /* * Backgrounds difining styles */
30
+ .bg-containers {
31
+ background: #f5f5f5 !important;
32
+ }
33
+ .bg-cards {
34
+ background: #fafafa !important;
35
+ }
36
+ .bg-active {
37
+ background: #e1ebf9 !important;
38
+ }
39
+
40
+ /* * Borders difining styles */
41
+ .border-active {
42
+ border: 1px solid #28408f !important;
43
+ }
44
+ .border-cards {
45
+ border: 1px solid #e9e9e9 !important;
46
+ }
47
+ .border-containers {
48
+ border-top: 3px solid #929292 !important;
49
+ }
50
+
51
+ .btn-primary {
52
+ background: #3658c1 !important;
53
+ @apply text-white hover:shadow-[inset_0_0_0_2px_#28408F];
54
+ }
55
+ }
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './components';
2
+ export { default as TableList } from './components/templates/TableList/components/TableList';
package/src/index.tsx ADDED
@@ -0,0 +1 @@
1
+ export * from './components/';
@@ -0,0 +1,42 @@
1
+ import '@imj_media/imj-ui/styles.css';
2
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
3
+ import Layout from '../components/templates/Layout';
4
+ import { UserLogProvider } from '../context/userLog.context';
5
+ import NoUser from './NoUser';
6
+ import NoAccessToken from './NoAccessToken';
7
+ import { UseApisProvider } from '../context/useApis.context';
8
+
9
+ interface AppTasksProps {
10
+ path: 'kanban-general' | 'kanban-campania' | 'lista-campanias';
11
+ user: User;
12
+ env: Env;
13
+ }
14
+
15
+ interface User {
16
+ id: number;
17
+ accessToken: string;
18
+ }
19
+
20
+ type Env = 'dev' | 'prod';
21
+
22
+ const AppTasks = ({ path, user, env }: AppTasksProps) => {
23
+ const queryClient = new QueryClient();
24
+
25
+ if (!user) return <NoUser />;
26
+ if (!user.accessToken) return <NoAccessToken />;
27
+
28
+ let configsContexts = { user, env };
29
+ return (
30
+ <UserLogProvider {...configsContexts}>
31
+ <UseApisProvider {...configsContexts}>
32
+ <div className="w-full h-full min-h-[100%] relative">
33
+ <QueryClientProvider client={queryClient}>
34
+ <Layout path={path} />
35
+ </QueryClientProvider>
36
+ </div>
37
+ </UseApisProvider>
38
+ </UserLogProvider>
39
+ );
40
+ };
41
+
42
+ export default AppTasks;
@@ -0,0 +1,20 @@
1
+
2
+ const NoAccessToken = () => {
3
+ return (
4
+ <div className="w-full h-full min-h-[100%] relative">
5
+ <div className="flex justify-center items-center h-full">
6
+ <div className="text-2xl font-bold flex flex-col items-center">
7
+ <div className="w-10 h-10 bg-primary-regular rounded-full animate-pulse"/>
8
+ <p className="text-l text-texts-enfasis">
9
+ No encontramos tu acceso
10
+ </p>
11
+ <p className="text-sm text-texts-placeholder">
12
+ por favor, contacta al administrador
13
+ </p>
14
+ </div>
15
+ </div>
16
+ </div>
17
+ )
18
+ }
19
+
20
+ export default NoAccessToken
@@ -0,0 +1,20 @@
1
+
2
+ const NoUser = () => {
3
+ return (
4
+ <div className="w-full h-full min-h-[100%] relative">
5
+ <div className="flex justify-center items-center h-full">
6
+ <div className="text-2xl font-bold flex flex-col items-center">
7
+ <div className="w-10 h-10 bg-primary-regular rounded-full animate-pulse"/>
8
+ <p className="text-l text-texts-enfasis">
9
+ un momento...
10
+ </p>
11
+ <p className="text-sm text-texts-placeholder">
12
+ estamos buscando tu usuario
13
+ </p>
14
+ </div>
15
+ </div>
16
+ </div>
17
+ )
18
+ }
19
+
20
+ export default NoUser