Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

google-sheets sin API, localstorage, preact, diffs de votos, link websocket a twitts de ecofeminita (filtrados con el tag #poroteo) #15

Open
wants to merge 110 commits into
base: master
Choose a base branch
from

Conversation

xaiki
Copy link

@xaiki xaiki commented Aug 7, 2018

como charlamos con nayla por mail, mando el PR, es mas una recollecion de pruebas que una voluntad de mergear.

el @rusosnith me pidio ver si podiamos precindir de la API y pegar directamente los datos GDocs/Sheets,
lo primero que hice fue integrar https://github.com/xaiki/picosheet para esto.
... y despues me cope

  • guardar los datos en localstorage
  • hacer un diff de lxs senadorxs y guardarlo en localstorage
  • mostrar el historico de los votos
  • refactore bastantes cosas para que tenga mas sentido poder usar el CSS en las distintas vistas
  • entonces empece a mirar tamaño y caching para dejarlo lo mas chiquito posible:
    • movi a react-scripts porque la config de webpack que tienen es la que siempre me dio mejores rendimientos (tambien el workflow de desplegar a gh-pages es bastante mas facil)
  • link websocket a una api en now.sh que manda info sobre twitts

fue mucha prueba y error, la verdad hoy no se si no estariamos mejor usando a API en now para mandar todos los datos reusando la que ya tienen. lo que si el cambio de next a react-script (y el uso de react-snap) permite:

  • hospedar facilemente en github pages y surge.sh (poroteo.surge.sh, xaiki.github.io/poroteo-prod)
  • dividir por 2 el peso de la pagina

abrazo.

xaiki added 30 commits August 2, 2018 17:38
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
they don't really belong into refresh

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
… logo

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
…omatically

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
…t also i need to sleep

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
my links are broken, but at least now they are all broken the same way

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
as it solves being hosted on a weird path

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
xaiki added 18 commits August 5, 2018 00:31
 - we get ALL that is the old endpoint that gets all the data (about 18k)
 - we get RESULTS that just updates the results
 - we get VOTES that updates the votes counts and has a checksum (1.4k)

we get ALL only once, and store it in localStorage, then if checksum changed, we update the results from ALL with the data from RESULTS, and recalc who changed opinion (based on the *current* clock)

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
when no changes were detected we never hydrated our structures,
now we make update return a promise that resolve to true || false
if it actually refreshed, and refresh inconditionally if it didn't

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
 - remove unused senators view
 - push back home page into index
 - remove react-router-dom and all uses of Link, Router, Route, Switch
 - push senators names into the bars with an ugly <ul>

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
@xaiki
Copy link
Author

xaiki commented Aug 7, 2018

 .gitignore                                            |   1 +
 components/head.js                                    |  11 ---
 components/links.js                                   |  35 -------
 components/tarjeta.js                                 | 126 -------------------------
 next.config.js                                        |  10 --
 package.json                                          |  39 ++++++--
 pages/index.js                                        | 104 ---------------------
 public/CNAME                                          |   1 +
 {static => public}/favicon.ico                        | Bin
 public/index.html                                     |  44 +++++++++
 public/manifest.json                                  |  15 +++
 scripts/build-preact.js                               |   8 ++
 src/ago.js                                            |  32 +++++++
 src/components/cambios.js                             |  44 +++++++++
 {components => src/components}/fecha-actualizacion.js |  13 +--
 {components => src/components}/footer.js              |  16 ++--
 {components => src/components}/header.js              |  23 +++--
 src/components/links.js                               |  39 ++++++++
 src/components/senator.js                             | 117 +++++++++++++++++++++++
 src/components/tarjeta.js                             |  27 ++++++
 src/constants.js                                      |  29 ++++++
 src/global.css                                        | 112 ++++++++++++++++++++++
 {static/assets => src}/img/logos/activa.png           | Bin
 {static/assets => src}/img/logos/activa2.png          | Bin
 {static/assets => src}/img/logos/ecofeminita.png      | Bin
 {static/assets => src}/img/logos/lasdesistemas.png    | Bin
 src/index.js                                          |   9 ++
 src/pages/index.js                                    | 223 ++++++++++++++++++++++++++++++++++++++++++++
 src/picosheet.js                                      |  37 ++++++++
 src/registerServiceWorker.js                          | 117 +++++++++++++++++++++++
 src/senadores.json                                    |  74 +++++++++++++++
 static/global.css                                     |   4 -
 32 files changed, 988 insertions(+), 322 deletions(-)

@xaiki
Copy link
Author

xaiki commented Aug 7, 2018 via email

xaiki added 10 commits August 8, 2018 10:36
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
and use senators in all code so that we don't have to filter twice

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant