Skip to content

Commit

Permalink
Merge pull request #53 from tobySolutions/feat/add-youtube
Browse files Browse the repository at this point in the history
Feat/add youtube
  • Loading branch information
tobySolutions authored Nov 27, 2024
2 parents 6ea2153 + c72a022 commit 227c6b0
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 217 deletions.
6 changes: 3 additions & 3 deletions packages/frontend/src/lib/components/socialCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const SocialMediaCards: React.FC = () => {
<FaFacebook />
<span>Facebook Page</span>
{/* Overlay for "Coming Soon" */}
<div className="absolute inset-0 flex items-center justify-center bg-black bg-opacity-50 text-white text-lg md:hover:flex md:opacity-0 md:hover:opacity-100">
<div className="absolute inset-0 flex items-center justify-center bg-black bg-opacity-50 text-white text-lg md:hover:flex md:hover:opacity-100">
Coming Soon
</div>
{/* Show "Coming Soon" on mobile */}
Expand All @@ -70,7 +70,7 @@ const SocialMediaCards: React.FC = () => {
<div className="bg-blue-800 relative w-48 text-white px-4 py-3 rounded-lg flex items-center space-x-2 cursor-pointer hover:bg-blue-900 transition">
<FaLinkedin />
<span>LinkedIn Page</span>
<div className="absolute inset-0 flex items-center justify-center bg-black bg-opacity-50 text-white text-lg md:hover:flex md:opacity-0 md:hover:opacity-100">
<div className="absolute inset-0 flex items-center justify-center bg-black bg-opacity-50 text-white text-lg md:hover:flex md:hover:opacity-100">
Coming Soon
</div>
{/* Show "Coming Soon" on mobile */}
Expand All @@ -86,7 +86,7 @@ const SocialMediaCards: React.FC = () => {
<FaXTwitter />
<span>X (Twitter)</span>
{/* Overlay for "Coming Soon" */}
<div className="absolute inset-0 flex items-center justify-center bg-black bg-opacity-50 text-white text-lg md:hover:flex md:opacity-0 md:hover:opacity-100">
<div className="absolute inset-0 flex items-center justify-center bg-black bg-opacity-50 text-white text-lg md:hover:flex md:hover:opacity-100">
Coming Soon
</div>
{/* Show "Coming Soon" on mobile */}
Expand Down
5 changes: 5 additions & 0 deletions packages/frontend/src/network/projects/projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,8 @@ export const getAccessToken = async (projectId: string) => {
);
return data;
};

export const fetchPlatforms = async () => {
const { data } = await instance.get(`/auth/profile`);
return data;
};
8 changes: 3 additions & 5 deletions packages/frontend/src/routes/Routes.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Route, Routes as BaseRoutes, Navigate } from "react-router-dom";
import Login from "./login";
import SignIn from "./signIn";
import DashboardHome from "./dashboard/home";
import Projects from "./dashboard/projects";
import SignUp from "./signup";
import ProjectPage from "./dashboard/projects/[id]";
import LivestreamPage from "./dashboard/projects/[id]/livestream/[livestremId]";
import { DemoPlayer } from "./dashboard/livestream";
Expand All @@ -17,10 +16,9 @@ import NotFound from "./NotFound";
export default function Routes() {
return (
<BaseRoutes>
<Route path="/" element={<Navigate to="/login/" replace />} />
<Route path="/" element={<Navigate to="/signIn/" replace />} />

<Route path="/login/" element={<Login />} />
<Route path="/signup/" element={<SignUp />} />
<Route path="/signIn/" element={<SignIn />} />
<Route path="/otp/" element={<Otp />} />

{/* Protected Routes */}
Expand Down
25 changes: 10 additions & 15 deletions packages/frontend/src/routes/dashboard/destination/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import { useLocation, useParams } from "react-router-dom";
import { getDataInCookie } from "../../../utils/utils";
import { ImTwitch } from "react-icons/im";
import { toast } from "react-toastify";
import { FetchProjectById } from "../../../network/projects/projects";
import {
fetchPlatforms
} from "../../../network/projects/projects";

export const Destination = () => {
const [viewDestinations, setViewDestinations] = useState(true);
Expand All @@ -33,11 +35,13 @@ export const Destination = () => {
}
}
};
const fetchProjectDetails = async (projectId: string | undefined) => {
const fetchPlatformsData = async () => {
setLoading(true);
try {
const response = await FetchProjectById(projectId!);
setDestinationData(response?.results?.platforms);
const response = await fetchPlatforms();
response?.data?.platforms
? setDestinationData(response?.data?.platforms)
: setDestinationData([]);
} catch (err: any) {
if (err?.response?.data?.message) {
toast.error(err?.response?.data?.message);
Expand All @@ -62,17 +66,8 @@ export const Destination = () => {
};

useEffect(() => {
const project = JSON.parse(getDataInCookie("projectData"));

if (!project) {
const userData = JSON.parse(getDataInCookie("userDataResponse"));
if (userData?.data?.platforms) {
setDestinationData(userData?.data?.platforms);
}
} else {
fetchProjectDetails(project?.identifier);
}

fetchPlatformsData();

if (
queryParams.get("code") &&
queryParams.get("scope") !== "https://www.googleapis.com/auth/youtube"
Expand Down
3 changes: 1 addition & 2 deletions packages/frontend/src/routes/dashboard/projects/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import "react-toastify/dist/ReactToastify.css";
import { useAppStore } from "../../../state";
import { useNavigate } from "react-router-dom";
import { Select } from "antd";
import { storeDataInCookie } from "../../../utils/utils";


function Projects() {
const [modalOpen, setModalOpen] = useState(false);
Expand All @@ -34,7 +34,6 @@ function Projects() {
try {
const res = await FetchAllProjects();
setProjectData(res?.results?.data);
storeDataInCookie("projectData", JSON.stringify(res?.results?.data[0]), 1);
} catch (error: any) {
console.error(error);
if (error?.response?.data?.message) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const defaultFormValues = {
email: "",
};

function Login() {
function SignIn() {
const [params] = useSearchParams();
const navigate = useNavigate();

Expand All @@ -50,7 +50,6 @@ function Login() {

if (userCodeFromCookie !== "") {
async function getUserData() {

try {
const userDataResponse = await getUserDetails(
userCodeFromCookie,
Expand All @@ -59,7 +58,7 @@ function Login() {

if (userDataResponse?.statusCode === 200) {
const token = userDataResponse.data.token.split(" ")[1];

storeDataInCookie(
"userDataResponse",
JSON.stringify(userDataResponse.data),
Expand All @@ -68,8 +67,6 @@ function Login() {
storeDataInCookie("userToken", token, 2);
navigate("/dashboard");
}


} catch (error: any) {
if (error?.response?.data?.message) {
toast.error(error?.response?.data?.message);
Expand Down Expand Up @@ -161,20 +158,11 @@ function Login() {
Sign in with MetaMask
</button> */}
</div>

<div className="my-[.8rem] text-white text-[15px] text-center">
<span>
Don't have an account?{" "}
<a href="/signup/" className="text-yellow-dark-9">
Sign Up
</a>
</span>
</div>
</div>
</form>
</div>
</div>
);
}

export default Login;
export default SignIn;
174 changes: 0 additions & 174 deletions packages/frontend/src/routes/signup/index.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions packages/frontend/src/routes/stream/stream.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ import { useNavigate } from "react-router-dom";
import { VscMute as MuteIcon } from "react-icons/vsc";
import { GoUnmute as UnmuteIcon } from "react-icons/go";
import {
RateSelectItem,
Seek,
VideoQualitySelectItem,
} from "@livepeer/react/player";
import { IoMdSettings as Settings } from "react-icons/io";
import { getDataInCookie } from "../../utils/utils";
import { toast } from "react-toastify";

export const Stream = () => {
Expand Down

0 comments on commit 227c6b0

Please sign in to comment.