Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
Feature/team and navbar (#182)
Browse files Browse the repository at this point in the history
* add server-only

* add client-only

* Move to RSC

* remove logging

* fix typings

* fix typings

* add LoginGridProps

* Fix possibly null

* Add types

* Check nulls

* fix possible nulls

* ignore errors in lightly used api

* Set conditionally

* Check null

* check null

* fix typings

* fix null errors

* fix null

* add typings

* fix props passing

* Add typing

* Add typing

* fix typings

* Fix typing errors

* use nonnull assertion

* Add styles

* Move to app folder

* Adhere to app api route

* Make it non default

* upgrade next-auth

* restore session provider

* Fixes in adapter

* move auth to pages to test use

* Fix login route

* fix import

* Pass authprovider

* Added sidebar test

* Add sidebar

* Fix navbar, extract navbar

* Fix layout

* Hide elements if no session

* Update Navbar.tsx

* Fix layout

* Make app dark

* Extract form

* Extract navbar

* Move to app

* Move layout out

* Remove logging

* REmove logging

* Move logingrid to RSC

* Remove logingrid

* Add layout

* Remove logging

* Remove logging

* Create getTeammates.ts

* Create Team page

* Fix heading

* Delete github.tsx

* Move to App router

* Update README.md, add title (#180)

* Update README.md, add title

* Update README.md

* Update README.md

* Update README.md (#181)

* Move to RSC

* Fix Try app ui

* Remove data logging

* Make card details a page

* Move layout to master layout

* Fix type

* Fix layout order

* Remove billing link
  • Loading branch information
EstebanDalelR committed Aug 4, 2023
1 parent c054560 commit f05fa39
Show file tree
Hide file tree
Showing 9 changed files with 485 additions and 771 deletions.
454 changes: 454 additions & 0 deletions app/api/actions/github/route.ts

Large diffs are not rendered by default.

35 changes: 11 additions & 24 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,33 @@
import "@primer/css/index.scss";

import { getServerSession } from "next-auth";

import AuthProvider from "../lib/auth/AuthProvider";
import Navbar from "../components/Navbar";
import { getServerSession } from "next-auth";
import Header from "../components/Header";
import LogInBtn from "../components/login-btn";

import AuthProvider from "../lib/auth/AuthProvider";

import { authOptions } from "./api/auth/[...nextauth]/route";
import { ReactNode, Suspense } from "react";

import LogInBtn from "../components/login-btn";
export const metadata = {
title: {
template: "%s | Watermelon",
default: "Watermelon",
},
title: "Watermelon",
description: "Get context on each PR",
};

export default async function RootLayout({
children,
}: {
children: ReactNode;
children: React.ReactNode;
}) {
const session = await getServerSession(authOptions);
let userEmail = session?.user?.email;
let userName = session?.user?.name;
if (!session) return <LogInBtn />;

return (
<html lang="en" data-color-mode="dark" data-dark-theme="dark">
<body style={{ minHeight: "100vh" }}>
{userEmail ? (
<>
<Header userEmail={userEmail} userToken={userName} />
<Navbar>
<AuthProvider>{children}</AuthProvider>
</Navbar>
</>
) : (
<LogInBtn />
)}
<body>
<Header />
<Navbar>
<AuthProvider>{children}</AuthProvider>
</Navbar>
</body>
</html>
);
Expand Down
13 changes: 3 additions & 10 deletions components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
"use client";
import Image from "next/image";
import { useSession, signOut } from "next-auth/react";
import { useEffect, useState } from "react";
export default function Header() {
const [userEmail, setUserEmail] = useState<string | null | undefined>(null);
const { data } = useSession();

useEffect(() => {
setUserEmail(data?.user?.email);
}, [data]);
import HeaderSignOut from "./HeaderSignOut";
export default function Header({ userEmail, userToken }) {
return (
<div className="Header d-flex flex-items-center flex-justify-between">
<a href="/" className="Header-link">
Expand Down Expand Up @@ -48,7 +41,7 @@ export default function Header() {
className="dropdown-item"
href={`vscode://watermelontools.watermelon-tools?email=${
userEmail ?? ""
}&token=${data?.user?.name ? data.user.name : ""}`}
}&token=${userToken ? userToken : ""}`}
>
VSCode Extension
</a>
Expand Down
2 changes: 0 additions & 2 deletions components/loginGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { useEffect, useState } from "react";

import InfoPanel from "../components/dashboard/InfoPanel";
import JiraLoginLink from "../components/JiraLoginLink";
import SlackLoginLink from "../components/SlackLoginLink";
Expand Down
16 changes: 16 additions & 0 deletions components/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Link from "next/link";

const sidebar = (
<nav className="SideNav border">
<Link className="SideNav-item" href="/">
Home
</Link>
<Link className="SideNav-item" href="/settings" aria-current="page">
Settings
</Link>
<Link className="SideNav-item" href="/billing">
Billing
</Link>
</nav>
);
export default sidebar;
77 changes: 0 additions & 77 deletions pages/actions/github.tsx

This file was deleted.

Loading

0 comments on commit f05fa39

Please sign in to comment.