Skip to content

Commit

Permalink
API keys accessible from profile/account (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
Winston-Hsiao authored Sep 18, 2024
1 parent 40b6052 commit 1afd1e7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const Container = (props: ContainerProps) => {
const { children } = props;

return (
<div className="mt-20 mx-4 sm:mx-6 md:mx-12 lg:mx-20 max-w-full">
<div className="my-20 mx-4 sm:mx-6 md:mx-12 lg:mx-20 max-w-full">
{children}
</div>
);
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/pages/APIKeys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const SingleKey = ({ token, permissions, onDelete }: SingleKeyProps) => {
onClick={() => setIsKeyVisible(!isKeyVisible)}
variant="primary"
>
{isKeyVisible ? "Hide" : "Show"}
{isKeyVisible ? "Hide" : "Show Key"}
</Button>
</p>

Expand Down Expand Up @@ -182,10 +182,10 @@ const APIKeys = () => {
/>
<div
className={cx(
"relative w-11 h-6 bg-gray-3 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-800",
"relative w-11 h-6 bg-gray-3 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-primary-9",
"rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full",
"peer-checked:after:border-gray-12 after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-gray-12",
"after:border-gray-6 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600",
"after:border-gray-6 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-primary-9",
)}
></div>
</label>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import NavSection from "@/components/home/NavSection";
const Home = () => {
return (
<main
className={`flex flex-col gap-8 items-center justify-center min-h-screen bg-gray-1 mb-12`}
className={`flex flex-col gap-8 items-center justify-center min-h-screen bg-gray-1`}
>
<HeroSection />
<KLangDemo />
Expand Down
14 changes: 10 additions & 4 deletions frontend/src/components/pages/Profile.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
import { useParams } from "react-router-dom";
import { useNavigate, useParams } from "react-router-dom";

import ListingGrid from "@/components/listings/ListingGrid";
import { Card, CardContent, CardHeader } from "@/components/ui/Card";
Expand All @@ -22,6 +22,7 @@ interface RenderProfileProps {
}

const RenderProfile = (props: RenderProfileProps) => {
const navigate = useNavigate();
const { user, onUpdateProfile, canEdit, listingIds } = props;
const [isEditing, setIsEditing] = useState(false);
const [isSubmitting, setIsSubmitting] = useState(false);
Expand Down Expand Up @@ -65,9 +66,14 @@ const RenderProfile = (props: RenderProfileProps) => {
{user.created_at ? formatJoinDate(user.created_at) : "Unknown date"}
</p>
{!isEditing && canEdit && (
<Button onClick={() => setIsEditing(true)} variant="outline">
Edit Profile
</Button>
<div className="flex space-x-2">
<Button onClick={() => navigate("/keys")} variant="primary">
API Keys
</Button>
<Button onClick={() => setIsEditing(true)} variant="outline">
Edit Profile
</Button>
</div>
)}
</CardHeader>
<CardContent>
Expand Down

0 comments on commit 1afd1e7

Please sign in to comment.