first commit

This commit is contained in:
Omer Sabic 2023-09-01 22:20:40 +02:00
commit 27c22293f6
26 changed files with 4334 additions and 0 deletions

13
.eslintignore Normal file
View File

@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock

14
.eslintrc.cjs Normal file
View File

@ -0,0 +1,14 @@
module.exports = {
root: true,
extends: ['eslint:recommended', 'plugin:svelte/recommended'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
extraFileExtensions: ['.svelte']
},
env: {
browser: true,
es2017: true,
node: true
}
};

10
.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

2
.npmrc Normal file
View File

@ -0,0 +1,2 @@
engine-strict=true
resolution-mode=highest

38
README.md Normal file
View File

@ -0,0 +1,38 @@
# create-svelte
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
## Creating a project
If you're seeing this, you've probably already done this step. Congrats!
```bash
# create a new project in the current directory
npm create svelte@latest
# create a new project in my-app
npm create svelte@latest my-app
```
## Developing
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
```bash
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
```
## Building
To create a production version of your app:
```bash
npm run build
```
You can preview the production build with `npm run preview`.
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.

17
jsconfig.json Normal file
View File

@ -0,0 +1,17 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias and https://kit.svelte.dev/docs/configuration#files
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}

3628
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

30
package.json Normal file
View File

@ -0,0 +1,30 @@
{
"name": "eyebrow-school",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch",
"lint": "eslint ."
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.20.4",
"autoprefixer": "^10.4.15",
"eslint": "^8.28.0",
"eslint-plugin-svelte": "^2.30.0",
"postcss": "^8.4.28",
"svelte": "^4.0.5",
"svelte-check": "^3.4.3",
"tailwindcss": "^3.3.3",
"typescript": "^5.0.0",
"vite": "^4.4.2"
},
"type": "module",
"dependencies": {
"@supabase/supabase-js": "^2.33.1"
}
}

6
postcss.config.js Normal file
View File

@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

3
src/app.css Normal file
View File

@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

12
src/app.d.ts vendored Normal file
View File

@ -0,0 +1,12 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface Platform {}
}
}
export {};

36
src/app.html Normal file
View File

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width" />
%sveltekit.head%
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700&display=swap"
rel="stylesheet">
<!-- <link rel="stylesheet" href="/app.css"> -->
<style>
* {
box-sizing: border-box;
padding: 0;
margin: 0;
transition-duration: 200ms;
}
html {
font-family: 'Poppins', sans-serif;
}
</style>
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>

View File

@ -0,0 +1,257 @@
<script>
import { authHandlers } from "../stores/store";
let email = "";
let password = "";
let confirmPass = "";
let error = false;
let errorMessage = "";
let register = false;
let authenticating = false;
async function handleAuthenticate() {
if (authenticating) {
return;
}
if (!email || !password || (register && !confirmPass)) {
error = true;
return;
}
authenticating = true;
try {
if (!register) {
await authHandlers.login(email, password);
} else {
await authHandlers.signup(email, password);
}
} catch (err) {
console.log("There was an auth error", err);
error = true;
authenticating = false;
}
}
function handleRegister() {
register = !register;
}
</script>
<div class="authContainer">
<form>
<h1>{register ? "Register" : "Login"}</h1>
{#if error}
<p class="error">The information you have entered is not correct</p>
{/if}
<label>
<p class={email ? " above" : " center"}>Email</p>
<input bind:value={email} type="email" placeholder="Email" />
</label>
<label>
<p class={password ? " above" : " center"}>Password</p>
<input
bind:value={password}
type="password"
placeholder="Password"
/>
</label>
{#if register}
<label>
<p class={confirmPass ? " above" : " center"}>
Confirm Password
</p>
<input
bind:value={confirmPass}
type="password"
placeholder="Confirm Password"
/>
</label>
{/if}
<button on:click={handleAuthenticate} type="button" class="submitBtn">
{#if authenticating}
<i class="fa-solid fa-spinner loadingSpinner" />
{:else}
Submit
{/if}
</button>
</form>
<div class="options">
<p>Or</p>
{#if register}
<div>
<p>Already have an account?</p>
<p on:click={handleRegister} on:keydown={() => {}}>Login</p>
</div>
{:else}
<div>
<p>Don't have an account?</p>
<p on:click={handleRegister} on:keydown={() => {}}>Register</p>
</div>
{/if}
</div>
</div>
<style>
.authContainer {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex: 1;
padding: 24px;
}
form {
display: flex;
flex-direction: column;
gap: 14px;
}
form,
.options {
width: 400px;
max-width: 100%;
margin: 0 auto;
}
form input {
width: 100%;
}
h1 {
text-align: center;
font-size: 3rem;
}
form label {
position: relative;
border: 1px solid navy;
border-radius: 5px;
}
form input {
border: none;
background: transparent;
color: black;
padding: 14px;
}
form input:focus {
border: none;
outline: none;
}
form label:focus-within {
border-color: blue;
}
form button {
background: navy;
color: white;
border: none;
padding: 14px 0;
border-radius: 5px;
cursor: pointer;
font-size: 1rem;
display: grid;
place-items: center;
}
form button:hover {
background: blue;
}
.above,
.center {
position: absolute;
transform: translateY(-50%);
pointer-events: none;
color: white;
border-radius: 4px;
padding: 0 6px;
font-size: 0.8rem;
}
.above {
top: 0;
left: 24px;
background: navy;
border: 1px solid blue;
font-size: 0.7rem;
}
.center {
top: 50%;
left: 6px;
border: 1px solid transparent;
opacity: 0;
}
.error {
color: coral;
font-size: 0.9rem;
text-align: center;
}
.options {
padding: 14px 0;
overflow: hidden;
font-size: 0.9rem;
display: flex;
flex-direction: column;
gap: 4px;
}
.options > p {
position: relative;
text-align: center;
width: fit-content;
margin: 0 auto;
padding: 0 8px;
}
.options > p::after,
.options > p::before {
position: absolute;
content: "";
top: 50%;
transform: translateY(-50%);
width: 100vw;
height: 1.5px;
background: white;
}
.options > p::after {
right: 100%;
}
.options > p::before {
left: 100%;
}
.options div {
display: flex;
align-items: center;
gap: 8px;
justify-content: center;
}
.options div p:last-of-type {
color: cyan;
cursor: pointer;
}
.loadingSpinner {
animation: spin 1s linear infinite;
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
</style>

View File

@ -0,0 +1,91 @@
<div
class="fixed bottom-0 left-0 z-50 w-full h-16 bg-white border-t border-gray-200 dark:bg-gray-700 dark:border-gray-600"
>
<div class="grid h-full max-w-lg grid-cols-4 mx-auto font-medium">
<a
type="button"
href="/home"
class="inline-flex flex-col items-center justify-center px-5 hover:bg-gray-50 dark:hover:bg-gray-800 group"
>
<svg
class="w-5 h-5 mb-2 text-gray-500 dark:text-gray-400 group-hover:text-blue-600 dark:group-hover:text-blue-500"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
viewBox="0 0 20 20"
>
<path
d="m19.707 9.293-2-2-7-7a1 1 0 0 0-1.414 0l-7 7-2 2a1 1 0 0 0 1.414 1.414L2 10.414V18a2 2 0 0 0 2 2h3a1 1 0 0 0 1-1v-4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v4a1 1 0 0 0 1 1h3a2 2 0 0 0 2-2v-7.586l.293.293a1 1 0 0 0 1.414-1.414Z"
/>
</svg>
<span
class="text-sm text-gray-500 dark:text-gray-400 group-hover:text-blue-600 dark:group-hover:text-blue-500"
>Home</span
>
</a>
<a
type="button"
class="inline-flex flex-col items-center justify-center px-5 hover:bg-gray-50 dark:hover:bg-gray-800 group"
>
<svg
class="w-5 h-5 mb-2 text-gray-500 dark:text-gray-400 group-hover:text-blue-600 dark:group-hover:text-blue-500"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
viewBox="0 0 20 20"
>
<path
d="M11.074 4 8.442.408A.95.95 0 0 0 7.014.254L2.926 4h8.148ZM9 13v-1a4 4 0 0 1 4-4h6V6a1 1 0 0 0-1-1H1a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h17a1 1 0 0 0 1-1v-2h-6a4 4 0 0 1-4-4Z"
/>
<path
d="M19 10h-6a2 2 0 0 0-2 2v1a2 2 0 0 0 2 2h6a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1Zm-4.5 3.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2ZM12.62 4h2.78L12.539.41a1.086 1.086 0 1 0-1.7 1.352L12.62 4Z"
/>
</svg>
<span
class="text-sm text-gray-500 dark:text-gray-400 group-hover:text-blue-600 dark:group-hover:text-blue-500"
>Wallet</span
>
</a>
<a
type="button"
class="inline-flex flex-col items-center justify-center px-5 hover:bg-gray-50 dark:hover:bg-gray-800 group"
href="/messages"
>
<svg
class="w-5 h-5 mb-2 text-gray-500 dark:text-gray-400 group-hover:text-blue-600 dark:group-hover:text-blue-500"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
viewBox="0 0 512 512"
>
<path
d="M48 64C21.5 64 0 85.5 0 112c0 15.1 7.1 29.3 19.2 38.4L236.8 313.6c11.4 8.5 27 8.5 38.4 0L492.8 150.4c12.1-9.1 19.2-23.3 19.2-38.4c0-26.5-21.5-48-48-48H48zM0 176V384c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V176L294.4 339.2c-22.8 17.1-54 17.1-76.8 0L0 176z"
/>
</svg>
<span
class="text-sm text-gray-500 dark:text-gray-400 group-hover:text-blue-600 dark:group-hover:text-blue-500"
>Messages</span
>
</a>
<a
type="button"
class="inline-flex flex-col items-center justify-center px-5 hover:bg-gray-50 dark:hover:bg-gray-800 group"
>
<svg
class="w-5 h-5 mb-2 text-gray-500 dark:text-gray-400 group-hover:text-blue-600 dark:group-hover:text-blue-500"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
viewBox="0 0 20 20"
>
<path
d="M10 0a10 10 0 1 0 10 10A10.011 10.011 0 0 0 10 0Zm0 5a3 3 0 1 1 0 6 3 3 0 0 1 0-6Zm0 13a8.949 8.949 0 0 1-4.951-1.488A3.987 3.987 0 0 1 9 13h2a3.987 3.987 0 0 1 3.951 3.512A8.949 8.949 0 0 1 10 18Z"
/>
</svg>
<span
class="text-sm text-gray-500 dark:text-gray-400 group-hover:text-blue-600 dark:group-hover:text-blue-500"
>Profile</span
>
</a>
</div>
</div>

View File

@ -0,0 +1,19 @@
<script>
/**
* @type {boolean}
*/
export let isSender;
/**
* @type {string}
*/
export let content;
</script>
<div class={`flex w-full mt-2 space-x-3 max-w-xs ${isSender ? "ml-auto justify-end" : "mr-auto"}`}>
<div>
<div class={`p-3 ${isSender ? "bg-blue-600 rounded-l-lg rounded-br-lg": "bg-gray-300 rounded-bl-lg rounded-r-lg"}`}>
<p class="text-sm">{content}</p>
</div>
<span class="text-xs text-gray-500 leading-none">2 min ago</span>
</div>
</div>

1
src/lib/index.js Normal file
View File

@ -0,0 +1 @@
// place files you want to import through the `$lib` alias in this folder.

3
src/lib/supabase.js Normal file
View File

@ -0,0 +1,3 @@
import { createClient } from '@supabase/supabase-js'
export const supabase = createClient('https://<project>.supabase.co', '<your-anon-key>')

36
src/routes/+layout.svelte Normal file
View File

@ -0,0 +1,36 @@
<script>
import { onMount } from "svelte";
import { authStore } from "../stores/store";
import BottomNav from "../components/BottomNav.svelte";
import '../app.css'
const nonAuthRoutes = ["/", "product"];
onMount(() => {
console.log("Mounting");
return unsubscribe;
});
</script>
<div class="mainContainer">
<div class="pb-16 h-full">
<slot />
</div>
<BottomNav />
</div>
<style>
.mainContainer {
height: 100vh;
color: white;
position: relative;
display: flex;
flex-direction: column;
max-width: 600px;
margin: 0 auto;
}
</style>

5
src/routes/+page.svelte Normal file
View File

@ -0,0 +1,5 @@
<script>
import Authenticate from "../components/Authenticate.svelte";
</script>
<Authenticate/>

View File

@ -0,0 +1,21 @@
<script>
</script>
<div class="mainContainer">
</div>
<style>
.mainContainer {
display: flex;
flex-direction: column;
min-height: 100vh;
gap: 24px;
padding: 24px;
width: 100%;
max-width: 570px;
margin: 0 auto;
background-color: white;
}
</style>

View File

@ -0,0 +1,34 @@
<script>
import Message from "../../components/messages/Message.svelte";
</script>
<div class="flex flex-col w-full h-full">
<div class="h-full overflow-scroll flex flex-col-reverse">
<Message isSender={true} content={"hello"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
<Message isSender={false} content={"yo wassup"}/>
</div>
<div class="flex h-12">
<input type="text" name="" id="" class="h-full w-full bg-gray-200 text-black p-4">
<button class="h-full w-16 bg-blue-500">Send</button>
</div>
</div>

28
src/stores/store.js Normal file
View File

@ -0,0 +1,28 @@
import { writable } from "svelte/store";
export const authStore = writable({
user: null,
loading: true,
data: {}
})
export const authHandlers = {
/**
*
* @param {string} email
* @param {string} pass
*/
signup: async (email, pass) => {
},
/**
*
* @param {string} email
* @param {string} pass
*/
login: async (email, pass) => {
},
logout: async () => {
}
}

BIN
static/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

15
svelte.config.js Normal file
View File

@ -0,0 +1,15 @@
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/kit/vite';
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter()
},
preprocess: vitePreprocess()
};
export default config;

9
tailwind.config.js Normal file
View File

@ -0,0 +1,9 @@
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{html,js,svelte,ts}'],
theme: {
extend: {},
},
plugins: [],
}

6
vite.config.js Normal file
View File

@ -0,0 +1,6 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit()]
});