Skip to content

Url share#147

Merged
tfloxolodeiro merged 39 commits intodevelopfrom
url-share
Dec 11, 2023
Merged

Url share#147
tfloxolodeiro merged 39 commits intodevelopfrom
url-share

Conversation

@tfloxolodeiro
Copy link
Contributor

@tfloxolodeiro tfloxolodeiro commented Dec 5, 2023

Copy link
Contributor

@asanzo asanzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buenas!!!
Me quedé sin tiempo para esto por hoy, me tengo que poner a hacer otras cosas. Dejo el comment con los comentarios que fui viendo.

¡No olvidar pensar algunos tests! Para empezar, el test que menciono en el back, si es que la lógica de cambio de usuario está acá en el front.

Comment on lines +37 to +38
const APP_URL = 'https://pilasbloques.program.ar/online'
const DEV_URL = 'localhost:3000'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esto está mal, debería no estar hardcodeado. Si quieren pasen esto a un issue.

Opción A

Jugar con el window.location.href

Opción B

Estar en un env.

Ya lo hacemos para la API (donde no podemos jugar con el location.href) :

https://github.com/Program-AR/pilas-bloques-react/blob/12addc9af5d4032fb23439518543c9d2d329a3c4/src/pbApi.ts#L39

Podría ser en el .env (y en el sample.env) un REACT_APP_URL=localhost:3000

Pero OJO, que hay que cambiar tmb en el workflow en el momento del build, como acá:

https://github.com/Program-AR/pilas-bloques-react/blob/12addc9af5d4032fb23439518543c9d2d329a3c4/.github/workflows/build.yml#L79C3-L79C3

No hace falta que un secret (de hecho, para la api tampoco!), puede ser directamente el string:

Ahí podría ser REACT_APP_URL: 'https://pilasbloques.program.ar/online'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

De hecho, si me lo pongo a pensar como app que cualquiera puede levantar en cualquier URL, la opción A es la más razonable.

return (<>
{challengeExists ? (
<>
<Header/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

El Header debería decir "nombreDeUsuario>título del desafío" con un breadcrumb

Copy link
Contributor

@asanzo asanzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Felicitaciones, gente, LA BU RA ZO @dlopezalvas @tfloxolodeiro 👏 👏 👏

Lo que menciono en mi review anterior del header lo podemos patear. Dejé un par de comments abajo pero está mergeable, felicitaciones. ALTO FEATURE LOCO

runs-on: ubuntu-latest
env:
REACT_APP_API_URL: ${{ secrets.API_URL }}
REACT_APP_PB_APP_URL: ${{ secrets.APP_URL }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

La de arriba y esta pueden ser directamente

        REACT_APP_API_URL: "https://pilasbloques.program.ar/api"
        REACT_APP_PB_APP_URL: "https://pilasbloques.program.ar/online/#/" 

(no sé bien cómo deben ser los caracteres finales, pero puede ser así, no son secretas esas url)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Idem en los otros jobs)

Comment on lines +52 to +54
const challenge: SerializedChallenge = LocalStorage.getCreatorChallenge()!
const sharedChallenge = await PilasBloquesApi.shareChallenge(challenge)
return sharedChallenge.sharedId
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esta lógica está repetida en ambos ShareUrlButton y SaveButton. Debería estar abajo en ChallengeUpsertButton.
Y si me apurás, también quiero el Snackbar del SaveButton en el botón compartir, porque después de todo estás guardando, está bien que le usuarie sepa que estamos guardando en ese momento.

el parámetro challengeUpsert no debería ser necesario.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Estos componentes quedaron re prolijos, gente, felicitaciones ❤️ . Estoy contento con cómo quedó. Hice un comment abajo sobre un posible refactor y pequeño cambio de lógica.

{challengeExists ? (
<>
<Header CenterComponent={<CreatorViewHeader challenge={challengeBeingEdited} />} SubHeader={<EditorSubHeader viewButton={<ReturnToEditionButton />} />} />
<Header CenterComponent={<CreatorViewHeader title={challengeBeingEdited.title} />} SubHeader={<EditorSubHeader viewButton={<ReturnToEditionButton />} />} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No entendí por qué pasa esto ahora...

const challenge = LocalStorage.getImportedChallenge()

return <>
<Header CenterComponent={<CreatorViewHeader title={challenge.titulo} />} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Epa, por qué el titulo viene en español??

Comment on lines +89 to +93
const shareChallenge = async () => {
renderComponent(<CreatorContextProvider><ShareModal/></CreatorContextProvider>)
const shareButton = await screen.findByTestId('upsertButton')
await act(async () => {shareButton.click()})
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bravo!!!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VAMO TODAVÍA CON LOS TESTS DE FRONT 👏👏👏👏👏👏👏

@tfloxolodeiro tfloxolodeiro merged commit 6df07ff into develop Dec 11, 2023
@tfloxolodeiro tfloxolodeiro deleted the url-share branch December 11, 2023 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Botón compartir por URL

3 participants