From 8dd029d2f1ef976977e36e5328c9d08943a98e24 Mon Sep 17 00:00:00 2001 From: David Snyder <45735850+GypsyDangerous@users.noreply.github.com> Date: Thu, 15 Oct 2020 09:06:12 -0400 Subject: [PATCH] Revert "Account settings (#28)" This reverts commit ee6ad10b8100585b75013e4880fd7c914f84fb05. --- src/components/DashBoard/Account/Account.js | 39 ++------------ .../DashBoard/Account/AccountComponent.js | 51 ++++--------------- .../DashBoard/Account/Accounts.scss | 24 +-------- 3 files changed, 15 insertions(+), 99 deletions(-) diff --git a/src/components/DashBoard/Account/Account.js b/src/components/DashBoard/Account/Account.js index bd0e608..33f5ab4 100644 --- a/src/components/DashBoard/Account/Account.js +++ b/src/components/DashBoard/Account/Account.js @@ -1,46 +1,15 @@ -import React, { useContext, useEffect, useState } from "react"; +import React, { useContext } from "react"; import { AppContext } from "../../../contexts/Appcontext"; import "./Accounts.scss"; import AccountComponent from "./AccountComponent"; -import firebase from "../../../firebase"; const Account = () => { - const currentUser = firebase.auth.currentUser; - const [discordAccount, setDiscordAccount] = useState(); - const [twitchAccount, setTwitchAccount] = useState(); - const [mainAccount, setMainAccount] = useState(); - - useEffect(() => { - (async () => { - const userRef = firebase.db.collection("Streamers").doc(currentUser?.uid); - const discordRef = userRef.collection("discord").doc("data"); - const twitchRef = userRef.collection("twitch").doc("data"); - const userData = (await userRef.get()).data(); - - if (!userData) return; - const twitchData = (await twitchRef.get()).data(); - discordRef.onSnapshot(snapshot => { - const discordData = snapshot.data() - if (discordData) { - const { name, profilePicture } = discordData; - setDiscordAccount({ name, profilePicture }); - } else { - setDiscordAccount(null); - } - }); - if (twitchData) { - const { name, profilePicture } = userData; - setTwitchAccount({ name, profilePicture }); - } - if(userData.discordLinked) setMainAccount("discord") - else if(userData.twitchAuthenticated) setMainAccount("twitch") - })(); - }, [currentUser]); + const { currentUser } = useContext(AppContext); return (
- {twitchAccount && } - {discordAccount && } + +
); }; diff --git a/src/components/DashBoard/Account/AccountComponent.js b/src/components/DashBoard/Account/AccountComponent.js index eb7e8f2..7c8d726 100644 --- a/src/components/DashBoard/Account/AccountComponent.js +++ b/src/components/DashBoard/Account/AccountComponent.js @@ -1,54 +1,21 @@ import React from "react"; -import styled from "styled-components"; -import firebase from "../../../firebase"; const logos = { - discord: "https://cdn.iconscout.com/icon/free/png-512/discord-3-569463.png", - twitch: "/social-media.svg", -}; - -const AccountName = styled.p` - text-transform: capitalize; -`; - -const DiscordComponent = ({ main, profilePicture, platform, name }) => { - const currentUser = firebase.auth.currentUser; - const disconnect = async () => { - await firebase.db - .collection("Streamers") - .doc(currentUser?.uid || " ") - .collection(platform) - .doc("data") - .delete(); - }; - - const deleteAccount = async () => { - await firebase.db - .collection("Streamers") - .doc(currentUser?.uid || " ") - .delete(); - try { - await currentUser.delete(); - } catch (err) { - // re-sign in and delete - } - }; + "discord": "https://cdn.iconscout.com/icon/free/png-512/discord-3-569463.png", + "twitch": "/social-media.svg" +} +const DiscordComponent = ({platform}) => { return (
- -
- {name} -

Account Name

-
-
-
- {main !== platform && ( - - )} +
+

+

Account Name

+
+
); }; diff --git a/src/components/DashBoard/Account/Accounts.scss b/src/components/DashBoard/Account/Accounts.scss index 2a7aeba..8252cf2 100644 --- a/src/components/DashBoard/Account/Accounts.scss +++ b/src/components/DashBoard/Account/Accounts.scss @@ -16,20 +16,12 @@ align-items: center; padding: .5rem 1rem; .name{ - margin-left: .5rem; - p{ - margin: 0; - } + margin-left: 2rem; p:nth-child(2){ - color: #aaa; - font-size: .75rem; + color: #aaa; } } img { - &:first-child{ - margin-right: 1rem; - filter: grayscale(1) brightness(1000%); - } width: 32px; } height: 50px; @@ -42,7 +34,6 @@ } .account-body { - box-sizing: border-box !important; min-height: 100px; &.twitch { background: #593695; @@ -50,16 +41,5 @@ &.discord { background: #7289da; } - display: flex; - align-items: center; - justify-content: flex-end; - padding: 2rem; - button{ - padding: .5rem 1rem; - background: #ee1111; - border: none; - font-weight: 600; - border-radius: .5rem; - } } }