diff --git a/README.md b/README.md index 997e180..a80d86c 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,4 @@ To set up Discord notifications: 1. Provide a `DISCORD_WEBHOOK_URL` that contains a valid Discord webhook endpoint. See [Discord's Webhook Guide](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) on how to create this endpoint in your server. 2. Set `WEBHOOK_URL` to `https:///webhook/discord` -Voila, your discord server will start receiving events. - - +Voila, your discord server will start receiving events. \ No newline at end of file diff --git a/app/components/github-card.tsx b/app/components/github-card.tsx new file mode 100644 index 0000000..38271bb --- /dev/null +++ b/app/components/github-card.tsx @@ -0,0 +1,83 @@ +import clsx from "clsx"; +import { Link, useLoaderData } from "react-router"; +import type { loader } from "~/routes/$project"; +import { Button } from "./button"; +import { usePopoverContext } from "./popover"; + +interface GitHubCardProps { + onBack: () => void; +} + +function GitHubCard({ onBack }: GitHubCardProps) { + const { installation } = useLoaderData(); + const popover = usePopoverContext(); + + function to() { + if (installation) { + return `https://github.com/settings/installations/${installation.githubInstallationId}`; + } + + return "https://github.com/apps/gr-s-todo-list/installations/new"; + } + + return ( + <> +
+ +
+ +
+
+
+
+ +

Github Integration

+ + {installation ? ( +

+ GitHub integration is{" "} + + {installation.active ? "active" : "paused"} + + . Tasks will {installation.active ? "" : "not "}automatically update + when you open or merge pull requests. +

+ ) : ( +

+ Connect Todo List with your GitHub account to automatically update the + status of tasks. +

+ )} + + + + + + ); +} + +export { GitHubCard }; diff --git a/app/components/status.tsx b/app/components/status.tsx index 468af57..12b0f6b 100644 --- a/app/components/status.tsx +++ b/app/components/status.tsx @@ -11,6 +11,7 @@ interface StatusProps { const StatusIcons: Record = { pending: "i-lucide-circle text-secondary", inProgress: "i-lucide-loader-circle text-amber-500", + inReview: "i-solar-document-add-linear text-green-500", done: "i-solar-check-circle-linear text-stone-400 dark:text-neutral-700", }; diff --git a/app/components/user-menu.tsx b/app/components/user-menu.tsx index acd8eec..b4d982c 100644 --- a/app/components/user-menu.tsx +++ b/app/components/user-menu.tsx @@ -2,26 +2,35 @@ import clsx from "clsx"; import React from "react"; import { Link, useLoaderData, useNavigate } from "react-router"; import type { loader } from "~/routes/$project"; +import { GitHubCard } from "./github-card"; import { InviteCard } from "./invite-card"; +type View = "default" | "github"; + function UserMenu() { - const { user } = useLoaderData(); + const { user, installation } = useLoaderData(); const navigate = useNavigate(); const [showInvite, setShowInvite] = React.useState(false); + const [view, setView] = React.useState("default"); - const handleLogout = () => { + function handleLogout() { const confirmed = window.confirm("Are you sure you want to logout?"); if (confirmed) { navigate("/logout"); } - }; + } + + if (view === "github") { + return ( + + setView("default")} /> + + ); + } return ( -
{!showInvite ? ( <> @@ -37,6 +46,7 @@ function UserMenu() {
)} +
    {user.superUser && (
  • @@ -50,6 +60,33 @@ function UserMenu() {
  • )} + + {user.superUser && ( +
  • + +
  • + )} +
  • +