Skip to content

Commit

Permalink
discord login btn
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperRonanCraft committed May 23, 2024
1 parent 13de524 commit 15118af
Show file tree
Hide file tree
Showing 16 changed files with 297 additions and 329 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
API_URL="http://localhost:3001/api"
94 changes: 84 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
"axios": "^1.6.8",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"dotenv": "^16.4.5",
"jwt-decode": "^3.1.2",
"lucide-react": "^0.378.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.51.4",
"react-router-dom": "^6.23.1",
"tailwind-merge": "^2.3.0",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.23.8"
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
"@eslint/compat": "^1.0.1",
Expand All @@ -46,5 +46,13 @@
"typescript": "^5.2.2",
"typescript-eslint": "^7.9.0",
"vite": "^5.2.0"
},
"overrides": {
"typescript": "^5.2.2"
},
"react-dotenv": {
"whitelist": [
"API_URL"
]
}
}
16 changes: 16 additions & 0 deletions public/assets/discord.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
window.env = {
"API_URL": "http://localhost:3001/api"
};
3 changes: 1 addition & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// import { ApolloClient, InMemoryCache, ApolloProvider } from "@apollo/client";

import "./index.css";
import { Outlet } from "react-router-dom";
import Nav from "./components/home/NavBar";
Expand All @@ -12,7 +11,7 @@ import Footer from "./components/home/Footer";
// });

function App() {
console.log("Welcome to Tomodachi!");
console.log("Welcome to RonanServices! Want to contribute?");
return (
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
<Nav />
Expand Down
17 changes: 17 additions & 0 deletions src/api/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import axios from "axios";

const client = axios.create({
// https://api.ronanplugins.com
baseURL: import.meta.env.VITE_API_URL,
responseType: "json",
withCredentials: true,
crossdomain: true,
});

export default {
async loginDiscord() {
// const params = new URLSearchParams({ username, password });

return client.get(`/auth/discord`);
},
};
39 changes: 39 additions & 0 deletions src/components/dialogs/LoginDialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import { Button } from "../ui/button";
import api from "@/api";

export default function LoginDialog() {
const loginHandler = () => {
api.loginDiscord();
};

return (
<Dialog>
<DialogTrigger className="font-bold">Login/Register</DialogTrigger>
<DialogContent className="h-1/3">
<DialogHeader>
<DialogTitle>Login/Register</DialogTitle>
<DialogDescription className="flex h-full items-center">
<Button
style={{ backgroundColor: "#5865F2" }}
className="flex items-center w-full"
variant={"default"}
onClick={loginHandler}
>
<img className="h-6 w-6 mr-2" src="/assets/discord.svg" />

<span>Continue with Discord</span>
</Button>
</DialogDescription>
</DialogHeader>
</DialogContent>
</Dialog>
);
}
Loading

0 comments on commit 15118af

Please sign in to comment.