@vixoniccom/footbal-score 1.2.1-beta.0 → 1.2.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.2.1](https://bitbucket.org/vixonic_dev/football-score/compare/v1.2.1-beta.1...v1.2.1) (2024-06-26)
6
+
7
+ ### [1.2.1-beta.1](https://bitbucket.org/vixonic_dev/football-score/compare/v1.2.1-beta.0...v1.2.1-beta.1) (2024-06-25)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * pagination was added to the app ([b847626](https://bitbucket.org/vixonic_dev/football-score/commit/b847626d7982b74c5e479fcc5878b65968349cc0))
13
+
5
14
  ### [1.2.1-beta.0](https://bitbucket.org/vixonic_dev/football-score/compare/v1.2.0...v1.2.1-beta.0) (2024-06-24)
6
15
 
7
16
 
package/build.zip CHANGED
Binary file
@@ -299,7 +299,7 @@
299
299
  {
300
300
  "type": "text-input",
301
301
  "id": "title0",
302
- "description": "Texto.",
302
+ "description": "Título",
303
303
  "show": "{{titleEnabled}} === true"
304
304
  },
305
305
  {
@@ -317,7 +317,21 @@
317
317
  {
318
318
  "type": "text-format",
319
319
  "id": "formatMjs",
320
- "label": "Formato Status"
320
+ "label": "Formato Mensaje"
321
+ },
322
+ {
323
+ "type": "number-input",
324
+ "id": "itemsPerPage",
325
+ "range": "[1:100]",
326
+ "label": "Elementos por página",
327
+ "defaultValue": 4
328
+ },
329
+ {
330
+ "type": "number-input",
331
+ "id": "durationPerPage",
332
+ "range": "[1:100]",
333
+ "label": "Duración por página (segundos)",
334
+ "defaultValue": 5
321
335
  },
322
336
  {
323
337
  "id": "alignVerticalMsj",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixoniccom/footbal-score",
3
3
  "alias": "Resultados Deportivos",
4
- "version": "1.2.1-beta.0",
4
+ "version": "1.2.1",
5
5
  "description": "Muestra resultados en vivo de fútbol.",
6
6
  "main": "main.js",
7
7
  "author": "",
@@ -1,12 +1,36 @@
1
- import React from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import { Row } from './components'
3
3
 
4
4
  type Props = {
5
- dataFixture: any
5
+ dataFixture: any[]
6
6
  parameters: VixonicParameters
7
7
  }
8
8
 
9
9
  export const Table = ({ dataFixture, parameters }: Props) => {
10
+ const { itemsPerPage, durationPerPage } = parameters
11
+ const rows = Number(itemsPerPage || 4)
12
+ const orderedData = dataFixture.sort((a, b) => a.fixture.timestamp - b.fixture.timestamp)
13
+ const [page, setPage] = useState<number>(1)
14
+ const [items, setItems] = useState<string[][]>(orderedData.slice(0, rows))
15
+ const total = orderedData.length
16
+
17
+ useEffect(() => {
18
+ const timer = setTimeout(() => {
19
+ handlePagination()
20
+ }, Number(durationPerPage || 5) * 1000)
21
+
22
+ return () => clearTimeout(timer)
23
+ }, [page, dataFixture])
24
+
25
+ const handlePagination = () => {
26
+ const newPage = page < (total / rows) ? page + 1 : 1
27
+ const startIndex = rows * (newPage - 1)
28
+ const endIndex = (startIndex + rows) < total ? startIndex + rows : total
29
+ const filterData = orderedData.slice(startIndex, endIndex)
30
+ setItems(filterData)
31
+ setPage(newPage)
32
+ }
33
+
10
34
  return <div
11
35
  style={{
12
36
  display: 'flex',
@@ -18,7 +42,7 @@ export const Table = ({ dataFixture, parameters }: Props) => {
18
42
  }}
19
43
  >
20
44
  {
21
- dataFixture.map((item: any) => (
45
+ items.map((item: any) => (
22
46
  <Row item={item} parameters={parameters} />
23
47
  ))
24
48
  }
@@ -76,6 +76,8 @@ declare type VixonicParameters = Partial<{
76
76
  league: string
77
77
  matchesTomorrow: boolean
78
78
  matchesYesterday: boolean
79
+ itemsPerPage: number
80
+ durationPerPage: number
79
81
  }>
80
82
 
81
83
  type GeneralData = {