From 4feda40d8eda511e45071375044d2e6f262fce78 Mon Sep 17 00:00:00 2001 From: TheNozomi <13172293+TheNozomi@users.noreply.github.com> Date: Fri, 9 Jul 2021 18:33:26 -0300 Subject: [PATCH 01/16] feat: discord authentication --- src/components/Auth/SignInForm.jsx | 45 ++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/src/components/Auth/SignInForm.jsx b/src/components/Auth/SignInForm.jsx index 843b4dd..bee4930 100644 --- a/src/components/Auth/SignInForm.jsx +++ b/src/components/Auth/SignInForm.jsx @@ -4,6 +4,7 @@ import { motion } from 'framer-motion' import { Dialog } from '@headlessui/react' import { yupResolver } from '@hookform/resolvers/yup' import * as yup from 'yup' +import Image from 'next/image' import { Input } from '@/components/Input' import { Button } from '@/components/Button' @@ -22,6 +23,8 @@ const schema = yup.object().shape({ export const SignIn = ({ onComplete, onRequestSignUp, unauthorizedMessage }) => { const [loading, setLoading] = useState(false) const [error, setError] = useState(null) + const [discordButtonLoading, setDiscordButtonLoading] = useState(false) + const [discordAuthError, setDiscordAuthError] = useState(null) const { register, handleSubmit, formState } = useForm({ resolver: yupResolver(schema), }) @@ -46,11 +49,33 @@ export const SignIn = ({ onComplete, onRequestSignUp, unauthorizedMessage }) => } } + const discordAuth = async () => { + setDiscordAuthError(null) + setDiscordButtonLoading(true) + try { + const { user, error } = await supabase.auth.signIn({ + provider: 'discord' + }, { + redirectTo: window.location.href + }) + + if (error) { + throw error + } else { + onComplete(user) + } + } catch(error) { + setError(error.error_description || error.message) + } finally { + setDiscordButtonLoading(false) + } + } + return (
-
+

Inicia sesión con tu email y contraseña.

@@ -71,6 +96,22 @@ export const SignIn = ({ onComplete, onRequestSignUp, unauthorizedMessage }) => Iniciar sesión
+
+
+ +
+

{getErrorMessage(discordAuthError)}

Date: Sun, 11 Jul 2021 19:52:50 -0300 Subject: [PATCH 02/16] git clase 3 --- .../academy/2-git/2-git-remote/readme.mdx | 257 ++++++++++++++++++ public/data/academy/2-git/readme.mdx | 1 - 2 files changed, 257 insertions(+), 1 deletion(-) create mode 100644 public/data/academy/2-git/2-git-remote/readme.mdx diff --git a/public/data/academy/2-git/2-git-remote/readme.mdx b/public/data/academy/2-git/2-git-remote/readme.mdx new file mode 100644 index 0000000..b3af85f --- /dev/null +++ b/public/data/academy/2-git/2-git-remote/readme.mdx @@ -0,0 +1,257 @@ +--- +title: 'Git remote' +publishedAt: '2021-06-27' +author: 'Tomas' +summary: '' +youtubeURL: '' +--- + +import { themes, Image } from 'mdx-deck' + + +# Clase 3: `git remote` + +### Tabla de contenidos + +1. Repositorios remotos + +1. Git fetch + +1. Git push + +1. Git pull + +1. Pull request (PR) + +--- + +## Repositorios remotos + +Hasta ahora todo lo que hicimos con git fue hacer cambios en nuestro repositorio local. El repositorio en nuestra computadora. + +Vimos un breve pantallazo de repositorios remotos al final de la primera clase, para poder subir nuestros cambios a GitHub. + +Los repositorios en GitHub son repositorios remotos! + +Entonces: + +> ##### Los repositorios remotos son repositorios en un server y accedemos a su información usando git. + +--- + + + +### Clonar un repositorio remoto + +Cuando usamos `git clone ` para clonar un repo, `repo_url` es la URL del repositorio remoto. + +En este caso git agrega automáticamente un *remote* llamado `origin` con esta URL. + +Esto es para que nuestro repositorio local recién clonado quede vinculado con el repositorio remoto original. + +--- + + +### git remote + +Para ver los _remotos_ que tenemos configurados hay que ejecutar `git remote`: +``` +$ git remote +origin +``` + +O `git remote -v` para ver las URL donde está el _remote_: +``` +$ git remote -v +origin git@github.com:tomasdisk/mi-repo.git (fetch) +origin git@github.com:tomasdisk/mi-repo.git (push) +``` + +* **fetch** es buscar, es la url donde git busca y lee info del _remote_ +* **push** empujar o publicar, es la url a donde git envia info desde nuestro repo local + +--- + + +### Agregar un remote + +Lo hicimos en la primera clase! + +Se hace con `git remote add `. + +Por ejemplo: +``` +$ git remote add origin_copia git@github.com:tomasdisk/mi-repo.git +$ git remote +origin +origin_copia +``` + +Ahora tenemos dos repositorios remotos (aunque los dos tengan la misma URL). + +--- + + +## Git fetch + +Se usa para traer información de un _remote_. + +``` +git fetch +``` + +Si queremos traer toda la información que tiene de `origin` que aún no tenemos en el repositorio local, hacemos: +``` +$ git fetch origin +``` + +Cómo origin es _remote_ por defecto, no es necesario aclararlo y podemos hacer solo `git fetch`. + +Esto trae todos los cambios(_commits_) del _remote_ pero no los combina(_mergea_) con nuestros cambios. + +--- + + +### ¿Dónde están esos cambios? + +Si hacemos `git branch` vamos a ver la ramas que tenemos: +``` +$ git branch + hotfix +* main +``` + +Pero si le agregamos `--all`, vamos a ver esto: +``` +$ git branch --all + hotfix +* main + remotes/origin/main + remotes/origin/testing +``` + +Nos esta mostrando nuestras ramas locales, pero también las ramas que conocemos del _remote_. + +--- + + +## Git push + +Cuando queremos compartir o publicar nuestros cambios, tenemos que enviarlos al servidor usando `git push `. + +Para enviar la rama `master` al servidor `origin`, entonces ejecutamos: +``` +$ git push origin master +``` + +Esto enviara todos los commits hechos en `master` al servidor. + +--- + +## Git pull + +`git pull `. + +Se usa para descargar lo cambios de una rama del _remote_ y mergearlos en la rama local en un solo paso. + +Por ejemplo: +``` +$ git pull origin master +``` + +En este caso estamos trayendo los cambios de la rama `origin/master` y haciendo el merge en la rama en la que estemos actualmente. + +Esto va a ser posible si no surgen conflictos en el _merge_ entre la rama remota y la local. + +--- + + +### Tracking o seguimiento de ramas + +Son ramas locales que tienen una relación directa con alguna rama remota. + +Esto facilita el uso de las ramas cuando queremos publicar y traernos cambios. + +Si hacemos `git remote show `, git nos da bastantes detalles del _remote_: +``` +$ git remote show origin +* remote origin + Fetch URL: git@github.com:tomasdisk/mi-repo.git + Push URL: git@github.com:tomasdisk/mi-repo.git + HEAD branch: main + Remote branches: + main tracked + testing tracked + Local branch configured for 'git pull': + main merges with remote main + Local ref configured for 'git push': + main pushes to main (local out of date) +``` + +Las últimas líneas dicen que `main` esta configurada para "seguir" a `origin/main`. + +Si nuestra rama está configurada para hacer seguimiento a una rama remota, al hacer `git push` o `git pull` sin especificar ningun _remote_ o _rama_, +nos va a enviar (push) o descargar (pull) los cambios de la rama que se este "siguiendo". + +--- + + +### Renombrar o eliminar remotos + +Renombrar `git remote rename `: +``` +$ git remote +origin +pb +$ git remote rename pb paul +$ git remote +origin +paul +``` + +Eliminar `git remote rm ` +``` +$ git remote rm paul +$ git remote +origin +``` + +--- + + +## Pull request (PR) + +Es una herramienta de GitHub para solicitar, revisar y mergear ramas del _remote_ de forma online. + +--- + + +### Ejercicios + +#### 1. Publicar cambios en una rama que no sea `master` o `main` + +- Crear una rama, hacer un commit con cambios +- Publicar la rama con `git push` + +#### 2. Crear el primer PR + +- Publicar una rama en GitHub y crear un PR +- Mergear el PR 😄 + +--- + +### Resumen + +Todos los comandos usados en la clase ✨ + +--- + + +### Bibliografía + +### 1. [Pro Git, Capitulo 2.5: Fundamentos de Git - Trabajar con Remotos](https://git-scm.com/book/es/v2/Fundamentos-de-Git-Trabajar-con-Remotos) +### 1. [Pro Git, Capitulo 3.5: Ramificaciones en Git - Ramas Remotas](https://git-scm.com/book/es/v2/Ramificaciones-en-Git-Ramas-Remotas) + +
+
+
diff --git a/public/data/academy/2-git/readme.mdx b/public/data/academy/2-git/readme.mdx index afe9904..46875dd 100644 --- a/public/data/academy/2-git/readme.mdx +++ b/public/data/academy/2-git/readme.mdx @@ -28,7 +28,6 @@ summary: 'Módulo de git, donde aprenderemos a usar git en la terminal para vers Cuando una tarea está lista, su rama se puede fusionar con otra para juntar los cambios! -## Próximamente, jueves 8 de Julio ## 2. `git remote` ### ¿Cómo trabajar con un repositorio remoto? From 718a55b31969b74f3a25d7573059d5647ba4de2c Mon Sep 17 00:00:00 2001 From: Ema Lorenzo Date: Sun, 11 Jul 2021 21:12:18 -0300 Subject: [PATCH 03/16] Fix git class index --- .../data/academy/2-git/{2-git-remote => 3-git-remote}/readme.mdx | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename public/data/academy/2-git/{2-git-remote => 3-git-remote}/readme.mdx (100%) diff --git a/public/data/academy/2-git/2-git-remote/readme.mdx b/public/data/academy/2-git/3-git-remote/readme.mdx similarity index 100% rename from public/data/academy/2-git/2-git-remote/readme.mdx rename to public/data/academy/2-git/3-git-remote/readme.mdx From e815b08696ff43547570fb2fc16c865c3a499208 Mon Sep 17 00:00:00 2001 From: tomasdisk Date: Sun, 11 Jul 2021 21:24:24 -0300 Subject: [PATCH 04/16] hasta luego --- src/pages/profile.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/profile.jsx b/src/pages/profile.jsx index f68bfb1..48d7c8f 100644 --- a/src/pages/profile.jsx +++ b/src/pages/profile.jsx @@ -16,7 +16,7 @@ const Profile = () => { supabase.auth.signOut() }} > - Cerrar sesión + Cerrar sesión, hasta luego! From 14b7dc265d66dd10e078972da424e4bc3c013dc6 Mon Sep 17 00:00:00 2001 From: Ema Lorenzo Date: Sun, 11 Jul 2021 21:28:15 -0300 Subject: [PATCH 05/16] Add a little message to signout button --- src/pages/profile.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/profile.jsx b/src/pages/profile.jsx index f68bfb1..44cc76c 100644 --- a/src/pages/profile.jsx +++ b/src/pages/profile.jsx @@ -11,6 +11,7 @@ const Profile = () => { <> {user &&
{JSON.stringify(user, null, 2)}
} +

Querés cambiar de cuenta cuenta o salir?

From f18d81d9c8f0966138a583ea56f7612f4d42a120 Mon Sep 17 00:00:00 2001 From: Ema Lorenzo Date: Sun, 11 Jul 2021 21:50:43 -0300 Subject: [PATCH 07/16] Styles for signout message --- src/pages/profile.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/profile.jsx b/src/pages/profile.jsx index b7d1a3c..f55dd49 100644 --- a/src/pages/profile.jsx +++ b/src/pages/profile.jsx @@ -11,7 +11,7 @@ const Profile = () => { <> {user &&
{JSON.stringify(user, null, 2)}
} -

Querés cambiar de cuenta cuenta o salir?

+

Querés cambiar de cuenta cuenta o salir?

-
+
-
-

{getErrorMessage(discordAuthError)}

+
+

{getErrorMessage(discordAuthError)}

{ const mesh = useRef() // Subscribe this to the render-loop, rotate the mesh every frame useFrame((state, delta) => - mesh.current - ? (mesh.current.rotation.y = mesh.current.rotation.x += 0.002) - : null + mesh.current ? (mesh.current.rotation.y = mesh.current.rotation.x += 0.002) : null ) // Return the view, these are regular Threejs elements expressed in JSX return ( diff --git a/src/components/Head.jsx b/src/components/Head.jsx index 0e0e4a1..8290f92 100644 --- a/src/components/Head.jsx +++ b/src/components/Head.jsx @@ -2,15 +2,10 @@ import NextHead from 'next/head' const TITLE = 'Coderhood' const URL = 'https://coderhood.dev/' -const DESCRIPTION = - 'La comunidad que impulsa el aprendizaje autodidacta y colaborativo' +const DESCRIPTION = 'La comunidad que impulsa el aprendizaje autodidacta y colaborativo' const author = 'Ema Lorenzo' -export const Head = ({ - title = TITLE, - url = URL, - description = DESCRIPTION, -}) => { +export const Head = ({ title = TITLE, url = URL, description = DESCRIPTION }) => { return ( <> diff --git a/src/examples/canvas/test_shader.js b/src/examples/canvas/test_shader.js index a2c51e4..6875452 100644 --- a/src/examples/canvas/test_shader.js +++ b/src/examples/canvas/test_shader.js @@ -43,8 +43,7 @@ const TestShader = (props) => { mesh.current.rotation.x = mesh.current.rotation.y += 0.01 } if (mesh.current.material) { - mesh.current.material.uniforms.time.value += - Math.sin(delta / 2) * Math.cos(delta / 2) + mesh.current.material.uniforms.time.value += Math.sin(delta / 2) * Math.cos(delta / 2) } }) diff --git a/src/layouts/Lesson.jsx b/src/layouts/Lesson.jsx index 1ab70c1..8fe52ba 100644 --- a/src/layouts/Lesson.jsx +++ b/src/layouts/Lesson.jsx @@ -26,9 +26,14 @@ export const LessonLayout = ({ title, frontMatter, pdfURL, lessons, children }) {/*

{author}

*/} -

- {publishedAt && format(parseISO(publishedAt), 'MMMM dd, yyyy')} -

+
+

+ {publishedAt && format(parseISO(publishedAt), 'MMMM dd, yyyy')} +

+

+ {author || null} +

+
{pdfURL ? ( ⚡️ Descarga el pdf de la clase

) : ( -

Próximamente

+

Próximamente en PDF

)}
diff --git a/src/layouts/Module.jsx b/src/layouts/Module.jsx index b9f6693..90862ae 100644 --- a/src/layouts/Module.jsx +++ b/src/layouts/Module.jsx @@ -12,9 +12,7 @@ export const ModuleLayout = ({ frontMatter, title, lessons, children }) => {
-
- {children} -
+
{children}
diff --git a/src/pages/index.jsx b/src/pages/index.jsx index 6634c9e..d014258 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -1,13 +1,13 @@ -import { useState, useEffect } from 'react' +// import { useState, useEffect } from 'react' import { motion } from 'framer-motion' -import { Bubbles } from '@/components/Bubbles' +// import { Bubbles } from '@/components/Bubbles' import { Container } from '@/components/Container' -import { learningBubbles } from '@/data/learningBubbles' -import { useAuth } from '@/hooks/useAuth' -import { Account } from '@/components/Account' +// import { learningBubbles } from '@/data/learningBubbles' +// import { useAuth } from '@/hooks/useAuth' +// import { Account } from '@/components/Account' // import { Auth } from '@/components/Auth/_Signin' -import { AuthModal } from '@/components/Auth' -import { supabase } from '@/lib/supabaseClient' +// import { AuthModal } from '@/components/Auth' +// import { supabase } from '@/lib/supabaseClient' const Home = ({ modules }) => { return ( diff --git a/src/pages/profile.jsx b/src/pages/profile.jsx index f55dd49..34f24ef 100644 --- a/src/pages/profile.jsx +++ b/src/pages/profile.jsx @@ -11,7 +11,9 @@ const Profile = () => { <> {user &&
{JSON.stringify(user, null, 2)}
} -

Querés cambiar de cuenta cuenta o salir?

+

+ Querés cambiar de cuenta cuenta o salir? +