-
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
1 parent
480ec68
commit a919773
Showing
7 changed files
with
262 additions
and
10 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 @@ | ||
export const BACKEND_URL="http://localhost:3000" |
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,88 @@ | ||
"use client" | ||
import Appbar from '@/components/Appbar' | ||
import DarkButton from '@/components/buttons/DarkButton' | ||
import axios from 'axios'; | ||
import { useEffect, useState } from 'react' | ||
import { BACKEND_URL } from '../config'; | ||
|
||
interface Zap { | ||
"id": string, | ||
"triggerId": string, | ||
"userId": number, | ||
"actions": | ||
{ | ||
"id": string, | ||
"zapId": string, | ||
"actionId": string, | ||
"sortingOrder": number, | ||
"type": { | ||
"id": string, | ||
"name": string | ||
} | ||
}[] | ||
} | ||
|
||
function useZaps() { | ||
const [loading, setLoading] = useState(true); | ||
const [zaps, setZaps] = useState<Zap[]>([]) | ||
useEffect(() => { | ||
axios.get(`${BACKEND_URL}/api/v1/zap`,{ | ||
headers:{ | ||
"Authorization":localStorage.getItem("token") | ||
} | ||
}) | ||
.then(res=>{ | ||
setZaps(res.data.zaps) | ||
setLoading(false) | ||
}) | ||
}, []) | ||
return { | ||
loading, | ||
zaps | ||
} | ||
} | ||
|
||
export default function Page() { | ||
const {loading,zaps}=useZaps() | ||
return ( | ||
<div> | ||
<Appbar /> | ||
<div className='flex justify-center pt-8'> | ||
<div className='max-w-screen-lg w-full'> | ||
<div className='flex justify-between'> | ||
<div className='text-2xl font-bold'> | ||
My Zaps | ||
</div> | ||
<DarkButton onClick={() => { | ||
|
||
}} size='big'>Create</DarkButton> | ||
</div> | ||
</div> | ||
</div> | ||
{loading ? "Loading": <ZapTable zaps={zaps}/>} | ||
|
||
</div> | ||
) | ||
} | ||
|
||
function ZapTable({zaps}:{zaps:Zap[]}){ | ||
return <table className="table-auto"> | ||
<thead> | ||
<tr> | ||
<th></th> | ||
<th>Name</th> | ||
<th>Last Edit</th> | ||
<th>Running</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>The Sliding Mr. Bones (Next Stop, Pottersville)</td> | ||
<td>Malcolm Lockyer</td> | ||
<td>1961</td> | ||
<td>1961</td> | ||
<td>1961</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
} |
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 |
---|---|---|
@@ -1,9 +1,58 @@ | ||
import React from 'react' | ||
"use client" | ||
import Appbar from '@/components/Appbar' | ||
import PrimaryButton from '@/components/buttons/PrimaryButton' | ||
import CheckFeature from '@/components/CheckFeature' | ||
import Input from '@/components/Input' | ||
import { useRouter } from 'next/navigation' | ||
import React, { useState } from 'react' | ||
import { BACKEND_URL } from '../config' | ||
import axios from 'axios' | ||
|
||
export default function page() { | ||
export default function Page() { | ||
const [email,setEmail]=useState(""); | ||
const [password,setPassword]=useState(""); | ||
const router=useRouter(); | ||
return ( | ||
<div> | ||
|
||
<Appbar /> | ||
<div className='flex justify-center'> | ||
<div className='flex pt-8 max-w-4xl'> | ||
<div className='flex-1 pt-20 px-4'> | ||
<div className='font-semibold text-3xl pb-4'> | ||
Join millions worldwide who automate their work using Zapier. | ||
</div> | ||
<div className='pb-8 pt-4' > | ||
<CheckFeature label='Easy setup, no coding required' /> | ||
</div> | ||
<div className='pb-8'> | ||
<CheckFeature label='Free forever for core features' /> | ||
</div> | ||
<div className='pb-6'> | ||
<CheckFeature label='14-day trial of premium features & apps' /> | ||
</div> | ||
</div> | ||
|
||
<div className='flex-1 pt-6 pb-6 px-4 mt-12 border rounded'> | ||
<Input type='text' label='Email' placeholder='Your Email' onChange={(e) => { | ||
setEmail(e.target.value) | ||
}} /> | ||
<Input type='password' label='Password' placeholder='Your Password' onChange={(e) => { | ||
setPassword(e.target.value) | ||
}} /> | ||
<div className='pt-4'> | ||
<PrimaryButton size='big' onClick={async() => { | ||
const response= await axios.post(`${BACKEND_URL}/api/v1/user/signin`,{ | ||
email:email, | ||
password:password | ||
}) | ||
localStorage.setItem("token",response.data.token) | ||
router.push("/dashboard") | ||
}} >Sign in</PrimaryButton> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
) | ||
} |
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,10 @@ | ||
"use client" | ||
import React, { ReactNode } from 'react' | ||
|
||
export default function DarkButton({ children, onClick, size }: { children: ReactNode, onClick: () => void, size?: "big" | "small" }) { | ||
return ( | ||
<div onClick={onClick} className={`${size === "small" ? "text-sm" : "text-xl"} ${size === "small" ? "px-8 pt-2" : "px-10 py-4"} hover:shadow-md bg-purple-800 text-white rounded cursor-pointer text-center mr-4`}> | ||
{children} | ||
</div> | ||
) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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