Skip to content

Commit 4acdf6a

Browse files
committed
added prettier. removed chat backend
1 parent 0724bc1 commit 4acdf6a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+9635
-9817
lines changed

.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"extends": "next/core-web-vitals"
2+
"extends": "next/core-web-vitals"
33
}

.prettierignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/node_modules
2+
/@types
3+
/interfaces
4+
/.next
5+
6+
.env
7+
.env.*
8+
*.env.*

.prettierrc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 4,
4+
"semi": true,
5+
"singleQuote": false,
6+
"bracketSameLine": true,
7+
"bracketSpacing": true,
8+
"arrowParens": "always",
9+
"singleAttributePerLine": false
10+
}

.vercelignore

-1
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ It is a project build to listen songs. Feed up of spotify's ads, I made this.
4242

4343
Version 1 : Version can be found [here](https://soundscape-anonymousxc.vercel.app/)
4444

45-
Version 2 : Full redesign of the app can be found [here](https://soundscape-psi.vercel.app/)
45+
Version 2 : Full redesign of the app can be found [here](https://soundscape-psi.vercel.app/)

app/album/[id]/page.tsx

+86-33
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use client'
1+
"use client";
22
import getAlbum from "@/app/server/getAlbum.server";
33
import Song from "@/components/global/SongBar";
44
import { AlbumResponse } from "@/interfaces/album";
@@ -8,49 +8,102 @@ import { Flex, Skeleton, Text } from "@chakra-ui/react";
88
import { useParams } from "next/navigation";
99
import { useEffect, useState } from "react";
1010

11-
1211
function Album() {
13-
14-
const id = useParams().id
15-
let [data, setData] = useState<AlbumResponse | null>()
16-
const [loaded, setLoaded] = useState(false)
12+
const id = useParams().id;
13+
let [data, setData] = useState<AlbumResponse | null>();
14+
const [loaded, setLoaded] = useState(false);
1715

1816
useEffect(() => {
19-
if (data) return () => { }
20-
getAlbum(id)
21-
.then((data: AlbumResponse) => {
22-
setData(data)
23-
sessionStorage.setItem('current-playlist', JSON.stringify(data))
24-
})
17+
if (data) return () => {};
18+
getAlbum(id).then((data: AlbumResponse) => {
19+
setData(data);
20+
sessionStorage.setItem("current-playlist", JSON.stringify(data));
21+
});
2522
return () => {
26-
data = null
27-
}
28-
}, [id])
23+
data = null;
24+
};
25+
}, [id]);
2926

3027
return (
31-
<Flex position={'relative'} top={0} left={0} width={'100%'} maxW={'100%'} background={'background'} height={'100%'} px={'1.25rem'} pt={'1rem'} flexDir={'column'} overflowY={'auto'} overflowX={'hidden'} pb={4}>
32-
<Flex gap={8} alignItems={'center'} flexDirection={['column', 'column', 'row']}>
33-
<Skeleton isLoaded={loaded} rounded={20} w={['150px', '150px', '250px']} h={['150px', '150px', '250px']}>
34-
<Image src={data?.image[2].link + ""} loader={() => data?.image[2].link + "?w=auto&h=auto"} maxW={['150px', '150px', '250px']} maxH={['150px', '150px', '250px']} width={250} height={250} alt="playlist icons" rounded={20} priority onLoadingComplete={() => setLoaded(true)} />
28+
<Flex
29+
position={"relative"}
30+
top={0}
31+
left={0}
32+
width={"100%"}
33+
maxW={"100%"}
34+
background={"background"}
35+
height={"100%"}
36+
px={"1.25rem"}
37+
pt={"1rem"}
38+
flexDir={"column"}
39+
overflowY={"auto"}
40+
overflowX={"hidden"}
41+
pb={4}>
42+
<Flex
43+
gap={8}
44+
alignItems={"center"}
45+
flexDirection={["column", "column", "row"]}>
46+
<Skeleton
47+
isLoaded={loaded}
48+
rounded={20}
49+
w={["150px", "150px", "250px"]}
50+
h={["150px", "150px", "250px"]}>
51+
<Image
52+
src={data?.image[2].link + ""}
53+
loader={() => data?.image[2].link + "?w=auto&h=auto"}
54+
maxW={["150px", "150px", "250px"]}
55+
maxH={["150px", "150px", "250px"]}
56+
width={250}
57+
height={250}
58+
alt="playlist icons"
59+
rounded={20}
60+
priority
61+
onLoadingComplete={() => setLoaded(true)}
62+
/>
3563
</Skeleton>
36-
<Skeleton isLoaded={loaded} w={'100%'} height={'100%'} alignItems={'center'} display={'flex'} rounded={20}>
37-
<Flex flexDirection={'column'} justifyContent={'center'}>
38-
<Text fontSize={['1.2rem', '1.2rem', '2rem']}> {data?.name} </Text>
39-
<Text fontSize={['0.8rem', '1rem', '1rem']}>Song Count : {data?.songCount} </Text>
40-
<Text fontSize={['0.8rem', '1rem', '1rem']}>Artists : {typeof data?.primaryArtists == 'string' ? data?.primaryArtists : ""} </Text>
41-
<Text fontSize={['0.8rem', '1rem', '1rem']}>Released : {data?.releaseDate} </Text>
64+
<Skeleton
65+
isLoaded={loaded}
66+
w={"100%"}
67+
height={"100%"}
68+
alignItems={"center"}
69+
display={"flex"}
70+
rounded={20}>
71+
<Flex flexDirection={"column"} justifyContent={"center"}>
72+
<Text fontSize={["1.2rem", "1.2rem", "2rem"]}>
73+
{" "}
74+
{data?.name}{" "}
75+
</Text>
76+
<Text fontSize={["0.8rem", "1rem", "1rem"]}>
77+
Song Count : {data?.songCount}{" "}
78+
</Text>
79+
<Text fontSize={["0.8rem", "1rem", "1rem"]}>
80+
Artists :{" "}
81+
{typeof data?.primaryArtists == "string"
82+
? data?.primaryArtists
83+
: ""}{" "}
84+
</Text>
85+
<Text fontSize={["0.8rem", "1rem", "1rem"]}>
86+
Released : {data?.releaseDate}{" "}
87+
</Text>
4288
</Flex>
4389
</Skeleton>
4490
</Flex>
45-
<Flex width={'100%'} mt={'1.5rem'} height={'100%'} overflowY={'auto'} flexDirection={'column'} gap={'0.4rem'} overflowX={'hidden'} className='hide-scroll-bar' px={1}>
46-
{
47-
data?.songs.map((val: SongResponse, idx: number) => {
48-
return (<Song data={val} key={idx} />)
49-
})
50-
}
91+
<Flex
92+
width={"100%"}
93+
mt={"1.5rem"}
94+
height={"100%"}
95+
overflowY={"auto"}
96+
flexDirection={"column"}
97+
gap={"0.4rem"}
98+
overflowX={"hidden"}
99+
className="hide-scroll-bar"
100+
px={1}>
101+
{data?.songs.map((val: SongResponse, idx: number) => {
102+
return <Song data={val} key={idx} />;
103+
})}
51104
</Flex>
52105
</Flex>
53-
)
106+
);
54107
}
55108

56-
export default Album;
109+
export default Album;

app/auth/page.tsx

+127-62
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,147 @@
1-
'use client'
2-
import loginFunc from '@/database/login';
3-
import signUpFunc from '@/database/signUp';
4-
import {
5-
Flex,
6-
Text,
7-
Input,
8-
Button
9-
} from '@chakra-ui/react'
10-
import { AuthResponse, AuthTokenResponsePassword } from '@supabase/supabase-js';
11-
import { useSearchParams } from 'next/navigation';
12-
import { useState } from 'react';
13-
import { toast } from 'react-toastify';
1+
"use client";
2+
import loginFunc from "@/database/login";
3+
import signUpFunc from "@/database/signUp";
4+
import { Flex, Text, Input, Button } from "@chakra-ui/react";
5+
import { AuthResponse, AuthTokenResponsePassword } from "@supabase/supabase-js";
6+
import { useSearchParams } from "next/navigation";
7+
import { useState } from "react";
8+
import { toast } from "react-toastify";
149

1510
function SignUpPage() {
16-
17-
const [email, setEmail] = useState<string>("")
18-
const [password, setPassword] = useState<string>("")
19-
const [username, setUsername] = useState<string>("")
20-
const [loading, setLoading] = useState(false)
21-
const [isLogin, setIsLogin] = useState(false)
22-
const id = useSearchParams().get('id')
11+
const [email, setEmail] = useState<string>("");
12+
const [password, setPassword] = useState<string>("");
13+
const [username, setUsername] = useState<string>("");
14+
const [loading, setLoading] = useState(false);
15+
const [isLogin, setIsLogin] = useState(false);
16+
const id = useSearchParams().get("id");
2317

2418
return (
25-
<Flex position={'relative'} top={0} left={0} width={'100%'} maxW={'100%'} background={'background'} height={['calc(100vh - 3.875rem - 8.2rem - 3.2rem)', 'calc(100vh - 6.25rem)']} flexDir={'column'} overflowY={'auto'} pb={2}>
26-
27-
<Flex w={'100%'} height={'100%'} flexDir={'column'}>
28-
<Text color={'primaryText'} fontWeight={'500'} fontSize={"1.2rem"}>
19+
<Flex
20+
position={"relative"}
21+
top={0}
22+
left={0}
23+
width={"100%"}
24+
maxW={"100%"}
25+
background={"background"}
26+
height={[
27+
"calc(100vh - 3.875rem - 8.2rem - 3.2rem)",
28+
"calc(100vh - 6.25rem)",
29+
]}
30+
flexDir={"column"}
31+
overflowY={"auto"}
32+
pb={2}>
33+
<Flex w={"100%"} height={"100%"} flexDir={"column"}>
34+
<Text
35+
color={"primaryText"}
36+
fontWeight={"500"}
37+
fontSize={"1.2rem"}>
2938
Sign Up / Log in
3039
</Text>
31-
<Flex flex={1} justifyContent={'center'} alignItems={'center'} flexDir={'column'}>
32-
<form style={{ display: 'flex', flexDirection: 'column', gap: '1rem', maxWidth: '25rem', width: '100%' }}>
33-
{
34-
isLogin ? "" :
35-
<Input placeholder='Enter username' onChange={(e) => setUsername(e.currentTarget.value)} />
36-
}
37-
<Input placeholder='Enter Email' onChange={(e) => setEmail(e.currentTarget.value)} type='email' />
38-
<Input placeholder='Enter Password' type='password' onChange={(e) => setPassword(e.currentTarget.value)} />
39-
<Button variant={'sidebar'} type='submit' className={'sidebar-active-tab'} justifyContent={'center'} isLoading={loading} w={'100%'}
40-
onSubmit={() => { return false }}
40+
<Flex
41+
flex={1}
42+
justifyContent={"center"}
43+
alignItems={"center"}
44+
flexDir={"column"}>
45+
<form
46+
style={{
47+
display: "flex",
48+
flexDirection: "column",
49+
gap: "1rem",
50+
maxWidth: "25rem",
51+
width: "100%",
52+
}}>
53+
{isLogin ? (
54+
""
55+
) : (
56+
<Input
57+
placeholder="Enter username"
58+
onChange={(e) =>
59+
setUsername(e.currentTarget.value)
60+
}
61+
/>
62+
)}
63+
<Input
64+
placeholder="Enter Email"
65+
onChange={(e) => setEmail(e.currentTarget.value)}
66+
type="email"
67+
/>
68+
<Input
69+
placeholder="Enter Password"
70+
type="password"
71+
onChange={(e) => setPassword(e.currentTarget.value)}
72+
/>
73+
<Button
74+
variant={"sidebar"}
75+
type="submit"
76+
className={"sidebar-active-tab"}
77+
justifyContent={"center"}
78+
isLoading={loading}
79+
w={"100%"}
80+
onSubmit={() => {
81+
return false;
82+
}}
4183
onClick={async () => {
42-
setLoading(true)
84+
setLoading(true);
4385
if (isLogin === false) {
44-
toast.info('Creating account...')
45-
signUpFunc(email, password, username, id || '')
46-
.then((AUTH: string) => {
47-
const data: AuthResponse = JSON.parse(AUTH || '{}')
48-
if (data.error != null) {
49-
toast.error(data.error.code)
50-
}
51-
else {
52-
toast.success("Account created successfully.")
53-
}
54-
setLoading(false)
55-
})
56-
}
57-
58-
else {
59-
toast.info("Logging in...")
60-
const loginStat = await loginFunc(email, password, username, id || '')
61-
const loginStatJSON = JSON.parse(loginStat) as AuthTokenResponsePassword;
86+
toast.info("Creating account...");
87+
signUpFunc(
88+
email,
89+
password,
90+
username,
91+
id || ""
92+
).then((AUTH: string) => {
93+
const data: AuthResponse = JSON.parse(
94+
AUTH || "{}"
95+
);
96+
if (data.error != null) {
97+
toast.error(data.error.code);
98+
} else {
99+
toast.success(
100+
"Account created successfully."
101+
);
102+
}
103+
setLoading(false);
104+
});
105+
} else {
106+
toast.info("Logging in...");
107+
const loginStat = await loginFunc(
108+
email,
109+
password,
110+
username,
111+
id || ""
112+
);
113+
const loginStatJSON = JSON.parse(
114+
loginStat
115+
) as AuthTokenResponsePassword;
62116
if (loginStatJSON.error) {
63-
toast.error("Either the password or email is incorrect.")
64-
}
65-
else if (loginStatJSON.data.user)
66-
toast.success("Logged in successfully")
67-
setLoading(false)
117+
toast.error(
118+
"Either the password or email is incorrect."
119+
);
120+
} else if (loginStatJSON.data.user)
121+
toast.success("Logged in successfully");
122+
setLoading(false);
68123
}
69124
}}>
70125
Submit
71126
</Button>
72127
</form>
73-
<Button onClick={() => { setIsLogin(!isLogin) }} variant={'unstyled'} fontSize={'0.8rem'} fontWeight={"400"} className='gradient-text' textAlign={'end'} w={'100%'} maxW={'25rem'} >
74-
{isLogin ? 'Sign Up' : 'Login'}
128+
<Button
129+
onClick={() => {
130+
setIsLogin(!isLogin);
131+
}}
132+
variant={"unstyled"}
133+
fontSize={"0.8rem"}
134+
fontWeight={"400"}
135+
className="gradient-text"
136+
textAlign={"end"}
137+
w={"100%"}
138+
maxW={"25rem"}>
139+
{isLogin ? "Sign Up" : "Login"}
75140
</Button>
76141
</Flex>
77142
</Flex>
78143
</Flex>
79-
)
144+
);
80145
}
81146

82-
export default SignUpPage;
147+
export default SignUpPage;

0 commit comments

Comments
 (0)