npm-pkg-hook 1.1.5 → 1.1.8
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.
- package/.eslintrc.js +19 -113
- package/.eslintrc.json +127 -108
- package/next.config.js +2 -5
- package/package.json +27 -24
- package/src/config/client/errors.js +14 -14
- package/src/config/client/index.js +1 -1
- package/src/hooks/getCategoriesWithProduct/helpers/index.js +7 -0
- package/src/hooks/getCategoriesWithProduct/index.js +62 -0
- package/src/hooks/getSession/index.js +18 -18
- package/src/hooks/index.js +13 -9
- package/src/hooks/useAcumulateDate/index.js +1 -1
- package/src/hooks/useAnimationFrame/index.js +45 -45
- package/src/hooks/useAsideCart/helpers/index.js +22 -0
- package/src/hooks/useAsideCart/index.js +156 -0
- package/src/hooks/useAsideCart/queries.js +10 -0
- package/src/hooks/useBanner/index.js +11 -11
- package/src/hooks/useCart/index.js +2 -0
- package/src/hooks/useCart/queries.js +164 -0
- package/src/hooks/useCart/useCart/helpers/index.js +75 -0
- package/src/hooks/useCart/useCart/index.js +411 -0
- package/src/hooks/useCart/useGetCart/index.js +31 -0
- package/src/hooks/useCatWithProduct/index.js +15 -15
- package/src/hooks/useCatWithProduct/queries.js +1 -1
- package/src/hooks/useCatWithProductClient/index.js +48 -0
- package/src/hooks/useCatWithProductClient/queries.js +55 -0
- package/src/hooks/useCategoriesProduct/index.js +12 -12
- package/src/hooks/useCategoriesProduct/queries.js +16 -16
- package/src/hooks/useCategoryInStore/index.js +39 -36
- package/src/hooks/useCategoryInStore/queries.js +78 -78
- package/src/hooks/useCategoryStore/index.js +2 -2
- package/src/hooks/useChartData/index.js +159 -156
- package/src/hooks/useChartData/useChartData/index.js +199 -197
- package/src/hooks/useChartData/useChartDataAllOrders/index.js +94 -94
- package/src/hooks/useCheckbox/index.js +115 -115
- package/src/hooks/useClients/index.js +12 -14
- package/src/hooks/useClients/queries.js +1 -1
- package/src/hooks/useConnection/index.js +20 -21
- package/src/hooks/useCreateProduct/helpers/useEditImageProduct/index.js +6 -2
- package/src/hooks/useCreateProduct/index.js +22 -19
- package/src/hooks/useDeleteSubProductOptional/index.js +31 -30
- package/src/hooks/useDeleteSubProductOptional/queries.js +10 -10
- package/src/hooks/useDessert/helpers/index.js +51 -51
- package/src/hooks/useDessert/index.js +56 -65
- package/src/hooks/useDevices/index.js +35 -36
- package/src/hooks/useDevices/queries.js +19 -19
- package/src/hooks/useDropzone/index.js +94 -79
- package/src/hooks/useDynamicAuth/index.js +13 -13
- package/src/hooks/useDynamicAuth/queries.js +24 -24
- package/src/hooks/useEmployee/queries.js +1 -1
- package/src/hooks/useEvent/index.js +33 -33
- package/src/hooks/useFavoriteStores/index.js +19 -0
- package/src/hooks/useFavoriteStores/queries.js +47 -0
- package/src/hooks/useFetchJson/index.js +25 -25
- package/src/hooks/useFingerprintjs/index.js +172 -176
- package/src/hooks/useFormTools/index.js +12 -11
- package/src/hooks/useFormatDate/index.js +20 -21
- package/src/hooks/useFormatNumberPhone/index.js +9 -9
- package/src/hooks/useFullScreenMode/index.js +65 -65
- package/src/hooks/useGenerateNumberArray/index.js +17 -17
- package/src/hooks/useGetExtProductFoodsSubOptionalAll/index.js +14 -0
- package/src/hooks/useGetFoodRecomended/index.js +33 -0
- package/src/hooks/useGetFoodRecomended/queries.js +47 -0
- package/src/hooks/useGetMinPrice/index.js +8 -0
- package/src/hooks/useGetMinPrice/queries.js +7 -0
- package/src/hooks/useGetOneStoreRating/index.js +40 -0
- package/src/hooks/useGetOneStoreRating/queries.js +18 -0
- package/src/hooks/useGoogleLogin/index.js +160 -161
- package/src/hooks/useHover/index.js +29 -29
- package/src/hooks/useImageOptimization/index.js +15 -15
- package/src/hooks/useImageWeight/index.js +18 -19
- package/src/hooks/useImagesStore/index.js +139 -140
- package/src/hooks/useImagesStore/queries.js +19 -18
- package/src/hooks/useInnerHtml/index.js +39 -38
- package/src/hooks/useIntersection/index.js +4 -4
- package/src/hooks/useKeypress/index.js +28 -28
- package/src/hooks/useLazyScript/index.js +35 -36
- package/src/hooks/useLocalSorage/index.js +2 -2
- package/src/hooks/useLogout/index.js +23 -23
- package/src/hooks/useManageQueryParams/index.js +36 -37
- package/src/hooks/useMobile/index.js +39 -38
- package/src/hooks/useMutateHeight/index.js +15 -16
- package/src/hooks/useOrderClient/index.js +5 -0
- package/src/hooks/useOrders/index.js +10 -16
- package/src/hooks/useOrders/queries.js +1 -1
- package/src/hooks/useProductsFood/index.js +32 -32
- package/src/hooks/useProductsFood/queriesStore.js +49 -48
- package/src/hooks/useProductsFood/useEditProduct.js +2 -4
- package/src/hooks/useProductsFood/usetagsProducts.js +83 -83
- package/src/hooks/useProviders/index.js +3 -3
- package/src/hooks/useProviders/queries.js +31 -31
- package/src/hooks/useProviders/useProvidersCreateStore/index.js +12 -13
- package/src/hooks/useProviders/useProvidersDataStore/index.js +24 -24
- package/src/hooks/useProvidersStore/index.js +24 -24
- package/src/hooks/useProvidersStore/queries.js +31 -31
- package/src/hooks/useRatingArrayData/index.js +54 -0
- package/src/hooks/{useRatingData → useRatingArrayData}/queries.js +19 -18
- package/src/hooks/useReactToPrint/index.js +1120 -1098
- package/src/hooks/useRemoveExtraProductFoodsOptional/index.js +23 -23
- package/src/hooks/useRemoveExtraProductFoodsOptional/queries.js +48 -48
- package/src/hooks/useReport/index.js +9 -9
- package/src/hooks/useReport/queries.js +1 -1
- package/src/hooks/useRestaurant/index.js +19 -19
- package/src/hooks/useRestaurant/queries.js +80 -80
- package/src/hooks/useSales/index.js +476 -451
- package/src/hooks/useSales/queries.js +14 -15
- package/src/hooks/useSales/useGetAllSales/index.js +25 -25
- package/src/hooks/useSales/useTotalSales.js +18 -18
- package/src/hooks/useSaveAvailableProduct/helpers/index.js +29 -29
- package/src/hooks/useSaveAvailableProduct/index.js +16 -16
- package/src/hooks/useSaveAvailableProduct/queries.js +1 -1
- package/src/hooks/useSchedule/index.js +33 -36
- package/src/hooks/useSchedule/index.jsx +22 -22
- package/src/hooks/useSchedule/queries.js +34 -35
- package/src/hooks/useScheduleData/index.js +123 -171
- package/src/hooks/useScroll/index.js +56 -57
- package/src/hooks/useScrollRotate/index.js +16 -14
- package/src/hooks/useSetSession/index.js +16 -16
- package/src/hooks/useSetState/index.js +3 -3
- package/src/hooks/useStatusOpenStore/helpers/index.js +101 -102
- package/src/hooks/useStatusOpenStore/index.js +172 -173
- package/src/hooks/useStatusOrdersClient/helpers/index.js +14 -0
- package/src/hooks/useStatusOrdersClient/index.js +17 -0
- package/src/hooks/useStatusOrdersClient/queries.js +80 -0
- package/src/hooks/useStore/index.js +40 -25
- package/src/hooks/useStore/queries.js +162 -136
- package/src/hooks/useStoreCalendar/index.js +5 -7
- package/src/hooks/useStoreContacts/index.js +16 -16
- package/src/hooks/useStoreContacts/queries.js +1 -1
- package/src/hooks/useTimeAgo/useTimeAgo.js +39 -39
- package/src/hooks/useUpdateCart/index.js +34 -28
- package/src/hooks/useUpdateExistingOrders/index.js +35 -35
- package/src/hooks/useUpdateExtProductFoodsSubOptional/index.js +38 -37
- package/src/hooks/useUser/index.js +1 -1
- package/src/hooks/useUser/queries.js +1 -1
- package/src/hooks/useWindowSize/index.js +38 -38
- package/src/mock/dessert/index.js +16 -16
- package/src/mock/index.js +1 -2
- package/src/utils/index.js +42 -45
- package/src/hooks/useRatingData/index.js +0 -53
- package/src/hooks/useSalesClient/index.js +0 -1
|
@@ -1,169 +1,169 @@
|
|
|
1
|
-
import { useMutation } from '@apollo/client'
|
|
1
|
+
import { useMutation } from '@apollo/client'
|
|
2
2
|
import {
|
|
3
3
|
useRef,
|
|
4
4
|
useState
|
|
5
|
-
} from 'react'
|
|
5
|
+
} from 'react'
|
|
6
6
|
import {
|
|
7
7
|
CREATE_BANNER_STORE,
|
|
8
8
|
CREATE_LOGO,
|
|
9
9
|
DELETE_ONE_BANNER_STORE,
|
|
10
10
|
DELETE_ONE_LOGO_STORE,
|
|
11
11
|
GET_ONE_BANNER_STORE
|
|
12
|
-
} from '../useProductsFood/queriesStore'
|
|
13
|
-
import { GET_ONE_STORE } from '../useStore/queries'
|
|
12
|
+
} from '../useProductsFood/queriesStore'
|
|
13
|
+
import { GET_ONE_STORE } from '../useStore/queries'
|
|
14
14
|
export { GET_MIN_PEDIDO } from './queries'
|
|
15
15
|
|
|
16
|
-
export const useImageStore = ({ idStore, sendNotification = () => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
export const useImageStore = ({ idStore, sendNotification = () => { } } = {}) => {
|
|
17
|
+
// STATES
|
|
18
|
+
const fileInputRef = useRef(null)
|
|
19
|
+
const [{ altLogo, srcLogo }, setPreviewImgLogo] = useState({})
|
|
20
|
+
const initialState = { alt: '/images/DEFAULTBANNER.png', src: '/images/DEFAULTBANNER.png' }
|
|
21
|
+
const [{ alt, src }, setPreviewImg] = useState(initialState)
|
|
22
|
+
const fileInputRefLogo = useRef(null)
|
|
23
|
+
// HOOKS
|
|
24
|
+
const [registerBanner] = useMutation(CREATE_BANNER_STORE, {
|
|
25
|
+
onCompleted: (data) => { return console.log({ message: data?.registerBanner?.message }) },
|
|
26
|
+
context: { clientName: 'admin-server' }
|
|
27
|
+
})
|
|
28
|
+
const [setALogoStore] = useMutation(CREATE_LOGO, {
|
|
29
29
|
onCompleted: (data) => { return console.log({ message: data?.setALogoStore?.message }) },
|
|
30
30
|
context: { clientName: 'admin-server' }
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
})
|
|
31
|
+
})
|
|
32
|
+
const [DeleteOneBanner] = useMutation(DELETE_ONE_BANNER_STORE, {
|
|
33
|
+
onCompleted: (data) => { return console.log({ message: data?.DeleteOneBanner?.message }) },
|
|
34
|
+
context: { clientName: 'admin-server' }
|
|
35
|
+
})
|
|
36
|
+
const [deleteALogoStore] = useMutation(DELETE_ONE_LOGO_STORE, {
|
|
37
|
+
onCompleted: (data) => {
|
|
38
|
+
console.log({
|
|
39
|
+
message: data.deleteALogoStore.message
|
|
40
|
+
})
|
|
41
|
+
setPreviewImgLogo(initialState)
|
|
42
|
+
},
|
|
43
|
+
context: { clientName: 'admin-server' },
|
|
44
|
+
update (cache) {
|
|
45
|
+
cache.modify({
|
|
46
|
+
fields: {
|
|
47
|
+
getStore (dataOld = []) {
|
|
48
|
+
return cache.writeQuery({ query: GET_ONE_STORE, data: dataOld })
|
|
49
|
+
}
|
|
52
50
|
}
|
|
53
|
-
|
|
54
|
-
// HANDLESS
|
|
55
|
-
const handleDeleteLogo = () => {
|
|
56
|
-
return deleteALogoStore({
|
|
57
|
-
variables: {
|
|
58
|
-
Image: ImageName || null
|
|
59
|
-
}
|
|
60
|
-
})
|
|
51
|
+
})
|
|
61
52
|
}
|
|
53
|
+
})
|
|
54
|
+
// HANDLESS
|
|
55
|
+
const handleDeleteLogo = () => {
|
|
56
|
+
return deleteALogoStore({
|
|
57
|
+
variables: {
|
|
58
|
+
Image: ''
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
63
|
+
const handleUpdateBanner = event => {
|
|
64
|
+
try {
|
|
65
|
+
const { files } = event.target
|
|
66
|
+
setPreviewImg(
|
|
67
|
+
files.length
|
|
68
|
+
? {
|
|
69
|
+
src: URL.createObjectURL(files[0]),
|
|
70
|
+
alt: files[0].name
|
|
71
|
+
}
|
|
72
|
+
: initialState
|
|
73
|
+
)
|
|
74
|
+
registerBanner({
|
|
75
|
+
variables: {
|
|
76
|
+
input: {
|
|
77
|
+
bnImage: files[0],
|
|
78
|
+
idStore
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
update (cache) {
|
|
82
|
+
cache.modify({
|
|
83
|
+
fields: {
|
|
84
|
+
getOneBanners (dataOld = []) {
|
|
85
|
+
return cache.writeQuery({ query: GET_ONE_BANNER_STORE, data: dataOld })
|
|
79
86
|
}
|
|
80
|
-
}, update(cache) {
|
|
81
|
-
cache.modify({
|
|
82
|
-
fields: {
|
|
83
|
-
getOneBanners(dataOld = []) {
|
|
84
|
-
return cache.writeQuery({ query: GET_ONE_BANNER_STORE, data: dataOld })
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
})
|
|
88
87
|
}
|
|
89
|
-
}).catch(() => {
|
|
90
|
-
sendNotification({
|
|
91
|
-
title: 'No pudimos cargar la imagen',
|
|
92
|
-
description: 'Error',
|
|
93
|
-
backgroundColor: 'error'
|
|
94
|
-
})
|
|
95
|
-
setPreviewImg(initialState)
|
|
96
|
-
})
|
|
97
|
-
} catch {
|
|
98
|
-
setPreviewImg(initialState)
|
|
99
|
-
sendNotification({
|
|
100
|
-
title: 'No pudimos cargar la imagen',
|
|
101
|
-
description: 'Error',
|
|
102
|
-
backgroundColor: 'error'
|
|
103
88
|
})
|
|
104
89
|
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
90
|
+
}).catch(() => {
|
|
91
|
+
sendNotification({
|
|
92
|
+
title: 'No pudimos cargar la imagen',
|
|
93
|
+
description: 'Error',
|
|
94
|
+
backgroundColor: 'error'
|
|
95
|
+
})
|
|
96
|
+
setPreviewImg(initialState)
|
|
97
|
+
})
|
|
98
|
+
} catch {
|
|
99
|
+
setPreviewImg(initialState)
|
|
100
|
+
sendNotification({
|
|
101
|
+
title: 'No pudimos cargar la imagen',
|
|
102
|
+
description: 'Error',
|
|
103
|
+
backgroundColor: 'error'
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const handleInputChangeLogo = event => {
|
|
108
|
+
const { files } = event.target
|
|
109
|
+
setPreviewImgLogo(
|
|
110
|
+
files.length
|
|
111
|
+
? {
|
|
112
|
+
srcLogo: URL.createObjectURL(files[0]),
|
|
113
|
+
altLogo: files[0].name
|
|
114
|
+
}
|
|
115
|
+
: initialState
|
|
116
|
+
)
|
|
117
|
+
setALogoStore({
|
|
118
|
+
variables: {
|
|
119
|
+
logo: files[0],
|
|
120
|
+
idStore
|
|
121
|
+
},
|
|
122
|
+
update (cache) {
|
|
123
|
+
cache.modify({
|
|
124
|
+
fields: {
|
|
125
|
+
getStore (dataOld = []) {
|
|
126
|
+
return cache.writeQuery({ query: GET_ONE_STORE, data: dataOld })
|
|
113
127
|
}
|
|
114
|
-
: initialState
|
|
115
|
-
)
|
|
116
|
-
setALogoStore({
|
|
117
|
-
variables: {
|
|
118
|
-
logo: files[0],
|
|
119
|
-
idStore: idStore
|
|
120
|
-
}, update(cache) {
|
|
121
|
-
cache.modify({
|
|
122
|
-
fields: {
|
|
123
|
-
getStore(dataOld = []) {
|
|
124
|
-
return cache.writeQuery({ query: GET_ONE_STORE, data: dataOld })
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
})
|
|
128
128
|
}
|
|
129
|
-
}).catch(() => {
|
|
130
|
-
sendNotification({
|
|
131
|
-
title: 'No pudimos cargar la imagen',
|
|
132
|
-
description: 'Error',
|
|
133
|
-
backgroundColor: 'error'
|
|
134
|
-
})
|
|
135
|
-
setPreviewImgLogo(initialState)
|
|
136
129
|
})
|
|
137
130
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
131
|
+
}).catch(() => {
|
|
132
|
+
sendNotification({
|
|
133
|
+
title: 'No pudimos cargar la imagen',
|
|
134
|
+
description: 'Error',
|
|
135
|
+
backgroundColor: 'error'
|
|
136
|
+
})
|
|
137
|
+
setPreviewImgLogo(initialState)
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
const HandleDeleteBanner = async () => {
|
|
141
|
+
setPreviewImg(initialState)
|
|
142
|
+
DeleteOneBanner({
|
|
143
|
+
variables: {
|
|
144
|
+
idStore
|
|
145
|
+
},
|
|
146
|
+
update (cache) {
|
|
147
|
+
cache.modify({
|
|
148
|
+
fields: {
|
|
149
|
+
getOneBanners (dataOld = []) {
|
|
150
|
+
return cache.writeQuery({ query: GET_ONE_BANNER_STORE, data: dataOld })
|
|
151
|
+
}
|
|
154
152
|
}
|
|
155
|
-
}).then(() => {
|
|
156
|
-
setPreviewImg(initialState)
|
|
157
153
|
})
|
|
158
154
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
155
|
+
}).then(() => {
|
|
156
|
+
setPreviewImg(initialState)
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
const onTargetClickLogo = e => {
|
|
160
|
+
e.preventDefault()
|
|
161
|
+
fileInputRefLogo.current.click()
|
|
162
|
+
}
|
|
163
|
+
const onTargetClick = e => {
|
|
164
|
+
e.preventDefault()
|
|
165
|
+
fileInputRef.current.click()
|
|
166
|
+
}
|
|
167
167
|
return {
|
|
168
168
|
fileInputRefLogo,
|
|
169
169
|
src,
|
|
@@ -180,4 +180,3 @@ export const useImageStore = ({ idStore, sendNotification = () => { return } } =
|
|
|
180
180
|
handleUpdateBanner
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { gql } from
|
|
1
|
+
import { gql } from '@apollo/client'
|
|
2
2
|
|
|
3
3
|
export const CREATE_SCHEDULE_STORE = gql`
|
|
4
4
|
mutation setStoreSchedule($input: IsStoreSchedule!) {
|
|
@@ -7,7 +7,7 @@ export const CREATE_SCHEDULE_STORE = gql`
|
|
|
7
7
|
message
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
`
|
|
11
11
|
export const GET_SCHEDULE_STORE = gql`
|
|
12
12
|
query getStoreSchedules($schDay: Int, $idStore: ID) {
|
|
13
13
|
getStoreSchedules(schDay: $schDay, idStore: $idStore) {
|
|
@@ -19,7 +19,7 @@ export const GET_SCHEDULE_STORE = gql`
|
|
|
19
19
|
schState
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
`
|
|
23
23
|
export const GET_ONE_SCHEDULE_STORE = gql`
|
|
24
24
|
query getOneStoreSchedules($schDay: Int, $idStore: ID) {
|
|
25
25
|
getOneStoreSchedules(schDay: $schDay, idStore: $idStore) {
|
|
@@ -30,7 +30,7 @@ export const GET_ONE_SCHEDULE_STORE = gql`
|
|
|
30
30
|
schState
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
`
|
|
34
34
|
export const GET_CAT_OF_PRODUCTS = gql`
|
|
35
35
|
query getAllCatOfProducts($idStore: ID) {
|
|
36
36
|
getAllCatOfProducts(idStore: $idStore) {
|
|
@@ -41,7 +41,7 @@ export const GET_CAT_OF_PRODUCTS = gql`
|
|
|
41
41
|
schState
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
`
|
|
45
45
|
export const REGISTER_CAT_OF_PRODUCTS = gql`
|
|
46
46
|
mutation updatedProducts($input: InputCatProducts) {
|
|
47
47
|
updatedProducts(input: $input) {
|
|
@@ -49,7 +49,7 @@ export const REGISTER_CAT_OF_PRODUCTS = gql`
|
|
|
49
49
|
message
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
`
|
|
53
53
|
export const REGISTER_CONTRACT_STORE = gql`
|
|
54
54
|
mutation createOneContract($input: InputContractType) {
|
|
55
55
|
createOneContract(input: $input) {
|
|
@@ -57,7 +57,7 @@ export const REGISTER_CONTRACT_STORE = gql`
|
|
|
57
57
|
message
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
`
|
|
61
61
|
export const GET_ALL_EMPLOYEE_STORE = gql`
|
|
62
62
|
query employees($umId: ID, $cId: ID, $aId: ID) {
|
|
63
63
|
employees(umId: $umId, cId: $cId, aId: $aId) {
|
|
@@ -73,7 +73,7 @@ export const GET_ALL_EMPLOYEE_STORE = gql`
|
|
|
73
73
|
eState
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
`
|
|
77
77
|
export const GET_ALL_PRODUCT_STORE = gql`
|
|
78
78
|
query productFoodsAll(
|
|
79
79
|
$search: String
|
|
@@ -138,7 +138,7 @@ export const GET_ALL_PRODUCT_STORE = gql`
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
`
|
|
142
142
|
export const GET_ALL_RATING_START_STORE = gql`
|
|
143
143
|
query getAllRatingStar($idStore: ID) {
|
|
144
144
|
getAllRatingStar(idStore: $idStore) {
|
|
@@ -148,7 +148,7 @@ export const GET_ALL_RATING_START_STORE = gql`
|
|
|
148
148
|
createAt
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
`
|
|
152
152
|
export const GET_ALL_VISITOR_STORE = gql`
|
|
153
153
|
query getAllVisitorStore(
|
|
154
154
|
$idStore: ID
|
|
@@ -173,13 +173,14 @@ export const GET_ALL_VISITOR_STORE = gql`
|
|
|
173
173
|
updateAt
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
|
|
176
|
+
`
|
|
177
177
|
export const GET_MIN_PEDIDO = gql`
|
|
178
178
|
query getMinPrice($idStore: ID) {
|
|
179
179
|
getMinPrice(idStore: $idStore)
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
`
|
|
182
182
|
|
|
183
|
+
// eslint-disable-next-line camelcase
|
|
183
184
|
export const GET_All_RATING_STORE = gql`
|
|
184
185
|
query getAllRating($idStore: ID) {
|
|
185
186
|
getAllRating(idStore: $idStore) {
|
|
@@ -195,7 +196,7 @@ export const GET_All_RATING_STORE = gql`
|
|
|
195
196
|
updateAt
|
|
196
197
|
}
|
|
197
198
|
}
|
|
198
|
-
|
|
199
|
+
`
|
|
199
200
|
export const CREATE_LOGO = gql`
|
|
200
201
|
mutation setALogoStore($logo: Upload, $idStore: ID) {
|
|
201
202
|
setALogoStore(logo: $logo, idStore: $idStore) {
|
|
@@ -203,7 +204,7 @@ export const CREATE_LOGO = gql`
|
|
|
203
204
|
message
|
|
204
205
|
}
|
|
205
206
|
}
|
|
206
|
-
|
|
207
|
+
`
|
|
207
208
|
export const CREATE_BANNER_STORE = gql`
|
|
208
209
|
mutation registerBanner($input: IBanner) {
|
|
209
210
|
registerBanner(input: $input) {
|
|
@@ -211,7 +212,7 @@ export const CREATE_BANNER_STORE = gql`
|
|
|
211
212
|
message
|
|
212
213
|
}
|
|
213
214
|
}
|
|
214
|
-
|
|
215
|
+
`
|
|
215
216
|
export const DELETE_ONE_LOGO_STORE = gql`
|
|
216
217
|
mutation deleteALogoStore($idStore: ID, $Image: String) {
|
|
217
218
|
deleteALogoStore(idStore: $idStore, Image: $Image) {
|
|
@@ -219,7 +220,7 @@ export const DELETE_ONE_LOGO_STORE = gql`
|
|
|
219
220
|
success
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
|
-
|
|
223
|
+
`
|
|
223
224
|
export const GET_ONE_BANNER_STORE = gql`
|
|
224
225
|
query getOneBanners($idStore: ID, $id: ID) {
|
|
225
226
|
getOneBanners(idStore: $idStore, id: $id) {
|
|
@@ -233,7 +234,7 @@ export const GET_ONE_BANNER_STORE = gql`
|
|
|
233
234
|
updateAt
|
|
234
235
|
}
|
|
235
236
|
}
|
|
236
|
-
|
|
237
|
+
`
|
|
237
238
|
export const DELETE_ONE_BANNER_STORE = gql`
|
|
238
239
|
mutation DeleteOneBanner(
|
|
239
240
|
$bnState: Int
|
|
@@ -253,4 +254,4 @@ export const DELETE_ONE_BANNER_STORE = gql`
|
|
|
253
254
|
message
|
|
254
255
|
}
|
|
255
256
|
}
|
|
256
|
-
|
|
257
|
+
`
|
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
import './styles.css'
|
|
4
|
-
|
|
5
|
-
const htmlText =
|
|
6
|
-
'<p style=\'display:inline;\'>Lorem ipsum</p> dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.'
|
|
7
|
-
|
|
8
|
-
function App() {
|
|
9
|
-
const [state, setState] = React.useState({
|
|
10
|
-
showOriginalHTML: false,
|
|
11
|
-
originalHTML: htmlText
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
const handleShowText = React.useCallback(() => {
|
|
15
|
-
setState(prevState => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}`
|
|
29
|
-
}}
|
|
30
|
-
/>
|
|
31
|
-
<button className='read-more' onClick={handleShowText}>
|
|
32
|
-
{!state.showOriginalHTML ? 'read more' : 'show less'}
|
|
33
|
-
</button>
|
|
34
|
-
</div>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { createRoot } from 'react-dom' // Import createRoot from react-dom
|
|
3
|
+
import './styles.css'
|
|
4
|
+
|
|
5
|
+
const htmlText =
|
|
6
|
+
'<p style=\'display:inline;\'>Lorem ipsum</p> dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.'
|
|
7
|
+
|
|
8
|
+
function App () {
|
|
9
|
+
const [state, setState] = React.useState({
|
|
10
|
+
showOriginalHTML: false,
|
|
11
|
+
originalHTML: htmlText
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const handleShowText = React.useCallback(() => {
|
|
15
|
+
setState((prevState) => {
|
|
16
|
+
return {
|
|
17
|
+
...prevState,
|
|
18
|
+
showOriginalHTML: !prevState.showOriginalHTML
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
}, [setState])
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className='container'>
|
|
25
|
+
<div
|
|
26
|
+
className='text'
|
|
27
|
+
dangerouslySetInnerHTML={{
|
|
28
|
+
__html: `${state.originalHTML}`
|
|
29
|
+
}}
|
|
30
|
+
/>
|
|
31
|
+
<button className='read-more' onClick={handleShowText}>
|
|
32
|
+
{!state.showOriginalHTML ? 'read more' : 'show less'}
|
|
33
|
+
</button>
|
|
34
|
+
</div>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const root = document.getElementById('root')
|
|
39
|
+
createRoot(root).render(<App />) // Use createRoot to render your React app
|
|
@@ -31,10 +31,10 @@ export const useOnScreen = (threshold = 0.6) => {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const defaultObserverOptions = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
34
|
+
root: null,
|
|
35
|
+
threshold: 0.1,
|
|
36
|
+
rootMargin: '0px'
|
|
37
|
+
}
|
|
38
38
|
|
|
39
39
|
export const useIntersectionObserver = ({
|
|
40
40
|
active = true,
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react'
|
|
2
|
-
|
|
3
|
-
export const useKeyPress = (targetKey) => {
|
|
4
|
-
const [keyPressed, setKeyPressed] = useState(false)
|
|
5
|
-
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
const downHandler = ({ key }) => {
|
|
8
|
-
if (key === targetKey) {
|
|
9
|
-
setKeyPressed(true)
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
const upHandler = ({ key }) => {
|
|
13
|
-
if (key === targetKey) {
|
|
14
|
-
setKeyPressed(false)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
window.addEventListener('keydown', downHandler)
|
|
19
|
-
window.addEventListener('keyup', upHandler)
|
|
20
|
-
|
|
21
|
-
return () => {
|
|
22
|
-
window.removeEventListener('keydown', downHandler)
|
|
23
|
-
window.removeEventListener('keyup', upHandler)
|
|
24
|
-
}
|
|
25
|
-
}, [targetKey])
|
|
26
|
-
|
|
27
|
-
return keyPressed
|
|
28
|
-
}
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
export const useKeyPress = (targetKey) => {
|
|
4
|
+
const [keyPressed, setKeyPressed] = useState(false)
|
|
5
|
+
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const downHandler = ({ key }) => {
|
|
8
|
+
if (key === targetKey) {
|
|
9
|
+
setKeyPressed(true)
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const upHandler = ({ key }) => {
|
|
13
|
+
if (key === targetKey) {
|
|
14
|
+
setKeyPressed(false)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
window.addEventListener('keydown', downHandler)
|
|
19
|
+
window.addEventListener('keyup', upHandler)
|
|
20
|
+
|
|
21
|
+
return () => {
|
|
22
|
+
window.removeEventListener('keydown', downHandler)
|
|
23
|
+
window.removeEventListener('keyup', upHandler)
|
|
24
|
+
}
|
|
25
|
+
}, [targetKey])
|
|
26
|
+
|
|
27
|
+
return keyPressed
|
|
28
|
+
}
|