generated from deco-sites/storefront
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
247 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export interface Props { | ||
id: string; | ||
} | ||
|
||
const getAssociation = async ( | ||
{ id }: Props, | ||
_req: Request, | ||
): Promise<unknown | null> => { | ||
try { | ||
const response = await fetch(`http://localhost:3000/associations/${id}`, { | ||
method: "GET", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}); | ||
|
||
const res = await response.json(); | ||
return res; | ||
} catch (e) { | ||
// console.log({ e }); | ||
return e; | ||
} | ||
}; | ||
|
||
export default getAssociation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
import FormWrap from "./FormWrap.tsx"; | ||
import { useEffect, useState } from "preact/hooks"; | ||
import Image from "apps/website/components/Image.tsx"; | ||
import Icon from "./Icon.tsx"; | ||
import { invoke } from "../../runtime.ts"; | ||
import Loading from "../../components/daisy/Loading.tsx"; | ||
|
||
export type Association = { | ||
cnpj: string; | ||
logo_url: string; | ||
name: string; | ||
}; | ||
|
||
function UserAssociatedSignup() { | ||
const [loading, setLoading] = useState(true); | ||
const [associationName, setAssociationName] = useState(""); | ||
const [associationLogo, setAssociationLogo] = useState(""); | ||
const [userName, setUserName] = useState( | ||
localStorage.getItem("nameUserAssociationSignup"), | ||
); | ||
|
||
useEffect(() => { | ||
setLoading(true); | ||
try { | ||
invoke["deco-sites/ecannadeco"].actions.getAssociation({ | ||
id: localStorage.getItem("associationSignup") || "", | ||
}).then((r) => { | ||
const resp = r as Association; | ||
setAssociationName(resp.name); | ||
setAssociationLogo(resp.logo_url); | ||
setLoading(false); | ||
}); | ||
} catch (e) { | ||
alert( | ||
"Não foi possível carregar associação. Contacte o suporte.", | ||
); | ||
} | ||
}, []); // Passando um array de dependências vazio | ||
|
||
const handleProceed = () => { | ||
localStorage.setItem("associationSignup", ""); | ||
window.location.href = "/entrar"; | ||
} | ||
|
||
return ( | ||
<FormWrap> | ||
{loading | ||
? <Loading style="loading-spinner" size="loading-md" /> | ||
: ( | ||
<div class="flex flex-col items-center gap-4"> | ||
<span class="text-2xl text-[#8b8b8b] font-semibold text-center my-4"> | ||
Bem vindo, {userName}! | ||
</span> | ||
<div class="flex flex-col gap-4 ietms-center"> | ||
<span> | ||
Reconhecemos que você possui associação com a{" "} | ||
<span class="font-bold">{associationName}</span> | ||
</span> | ||
<div class="flex justify-center"> | ||
<Image | ||
src={associationLogo} | ||
alt={"logo associação"} | ||
width={117} | ||
height={32} | ||
/> | ||
</div> | ||
<span> | ||
Por conta da sua associação, você tem condições especiais para | ||
garantir sua segurança como paciente de cannabis medicinal. | ||
</span> | ||
</div> | ||
<div class="flex w-full"> | ||
<ul class="flex flex-col gap-3 w-full"> | ||
<li class="flex gap-3 items-center"> | ||
<Icon | ||
class="text-primary" | ||
id="CircleCheck" | ||
size={17} | ||
/> | ||
<span class="text-[10px]"> | ||
Uso gratuito estendido | ||
</span> | ||
</li> | ||
<li class="flex gap-3 items-center"> | ||
<Icon | ||
class="text-primary" | ||
id="CircleCheck" | ||
size={17} | ||
/> | ||
<span class="text-[10px]"> | ||
Carteirinha digital oficial | ||
</span> | ||
</li> | ||
<li | ||
class={`flex gap-3 items-center`} | ||
> | ||
<Icon | ||
class="text-primary" | ||
id="CircleCheck" | ||
size={17} | ||
/> | ||
<span class="text-[10px]"> | ||
Upload ilimitado de documentos | ||
</span> | ||
</li> | ||
<li | ||
class={`flex gap-3 items-center`} | ||
> | ||
<Icon | ||
class="text-primary" | ||
id="CircleCheck" | ||
size={17} | ||
/> | ||
<span class="text-[10px]"> | ||
Suporte ilimitado do uso da plataforma | ||
</span> | ||
</li> | ||
</ul> | ||
</div> | ||
<div class="flex flex-col gap-4"> | ||
<span> | ||
Agora que o seu cadastro está feito, basta prosseguir para o | ||
login e acessar sua conta. | ||
</span> | ||
<button onClick={handleProceed} class="btn btn-primary text-white w-full mt-2"> | ||
PROSSEGUIR | ||
</button> | ||
</div> | ||
</div> | ||
)} | ||
</FormWrap> | ||
); | ||
} | ||
|
||
export default UserAssociatedSignup; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Component from "deco-sites/ecannadeco/components/ui/UserAssociatedSignup.tsx"; | ||
|
||
function Island() { | ||
return <Component />; | ||
} | ||
|
||
export default Island; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.