-
Notifications
You must be signed in to change notification settings - Fork 0
chore: spin down aws resources #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { Banner, BannerClose, BannerTitle } from "@/components/ui/banner"; | ||
|
|
||
| interface BannerComponentInterface { | ||
| title: string; | ||
| } | ||
|
|
||
| export default function BannerComponent({ title }: BannerComponentInterface) { | ||
| return ( | ||
| <Banner> | ||
| <BannerTitle>{title}</BannerTitle> | ||
| <BannerClose /> | ||
| </Banner> | ||
| ); | ||
| } |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |||||||||
|
|
||||||||||
| import LoginX from "@/components/Authentication/LoginX"; | ||||||||||
| import BackButton from "@/components/BackButton"; | ||||||||||
| import BannerComponent from "@/components/Banner"; | ||||||||||
| import { AppearanceToggle } from "@/components/ui/appearance-toggle"; | ||||||||||
| import { useAuthStatus } from "@/hooks/use-auth-status"; | ||||||||||
| import { usePathname } from "next/navigation"; | ||||||||||
|
|
@@ -11,12 +12,18 @@ export default function Header() { | |||||||||
| const { authData } = useAuthStatus(); | ||||||||||
|
|
||||||||||
| return ( | ||||||||||
| <header className="flex flex-row items-center justify-between px-4 py-6 md:px-6"> | ||||||||||
| <div>{pathname !== "/" && <BackButton />}</div> | ||||||||||
| <div className="flex items-center gap-2"> | ||||||||||
| <LoginX name={authData?.name ?? ""} /> | ||||||||||
| <AppearanceToggle /> | ||||||||||
| </div> | ||||||||||
| </header> | ||||||||||
| <> | ||||||||||
| <BannerComponent | ||||||||||
| title="β οΈ Notice: AWS resources have been spun down. The backend is | ||||||||||
| currently not running." | ||||||||||
|
Comment on lines
+17
to
+18
|
||||||||||
| title="β οΈ Notice: AWS resources have been spun down. The backend is | |
| currently not running." | |
| title={`β οΈ Notice: AWS resources have been spun down. The backend is | |
| currently not running.`} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| "use client"; | ||
|
|
||
| import { Button } from "@/components/ui/button"; | ||
| import { cn } from "@/lib/constants/utils"; | ||
| import { useControllableState } from "@radix-ui/react-use-controllable-state"; | ||
| import { type LucideIcon, XIcon } from "lucide-react"; | ||
| import { | ||
| type ComponentProps, | ||
| createContext, | ||
| type HTMLAttributes, | ||
| type MouseEventHandler, | ||
| useContext, | ||
| } from "react"; | ||
|
|
||
| type BannerContextProps = { | ||
| show: boolean; | ||
| setShow: (show: boolean) => void; | ||
| }; | ||
|
|
||
| export const BannerContext = createContext<BannerContextProps>({ | ||
| show: true, | ||
| setShow: () => {}, | ||
| }); | ||
|
|
||
| export type BannerProps = HTMLAttributes<HTMLDivElement> & { | ||
| visible?: boolean; | ||
| defaultVisible?: boolean; | ||
| onClose?: () => void; | ||
| inset?: boolean; | ||
| }; | ||
|
|
||
| export const Banner = ({ | ||
| children, | ||
| visible, | ||
| defaultVisible = true, | ||
| onClose, | ||
| className, | ||
| inset = false, | ||
| ...props | ||
| }: BannerProps) => { | ||
| const [show, setShow] = useControllableState({ | ||
| defaultProp: defaultVisible, | ||
| prop: visible, | ||
| onChange: onClose, | ||
| }); | ||
|
|
||
| if (!show) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <BannerContext.Provider value={{ show, setShow }}> | ||
| <div | ||
| className={cn( | ||
| "flex w-full items-center justify-between gap-2 bg-orange-400 px-4 py-1 text-white", | ||
| inset && "rounded-lg", | ||
| className, | ||
| )} | ||
| {...props} | ||
| > | ||
| {children} | ||
| </div> | ||
| </BannerContext.Provider> | ||
| ); | ||
| }; | ||
|
|
||
| export type BannerIconProps = HTMLAttributes<HTMLDivElement> & { | ||
| icon: LucideIcon; | ||
| }; | ||
|
|
||
| export const BannerIcon = ({ | ||
| icon: Icon, | ||
| className, | ||
| ...props | ||
| }: BannerIconProps) => ( | ||
| <div | ||
| className={cn( | ||
| "rounded-full border border-background/20 bg-background/10 p-1 shadow-sm", | ||
| className, | ||
| )} | ||
| {...props} | ||
| > | ||
| <Icon size={16} /> | ||
| </div> | ||
| ); | ||
|
|
||
| export type BannerTitleProps = HTMLAttributes<HTMLParagraphElement>; | ||
|
|
||
| export const BannerTitle = ({ className, ...props }: BannerTitleProps) => ( | ||
| <p className={cn("flex-1 text-sm", className)} {...props} /> | ||
| ); | ||
|
|
||
| export type BannerActionProps = ComponentProps<typeof Button>; | ||
|
|
||
| export const BannerAction = ({ | ||
| variant = "ghost", | ||
| size = "sm", | ||
| className, | ||
| ...props | ||
| }: BannerActionProps) => ( | ||
| <Button | ||
| className={cn("shrink-0 bg-transparent", className)} | ||
| size={size} | ||
| variant={variant} | ||
| {...props} | ||
| /> | ||
| ); | ||
|
|
||
| export type BannerCloseProps = ComponentProps<typeof Button>; | ||
|
|
||
| export const BannerClose = ({ | ||
| variant = "transparent", | ||
| size = "icon", | ||
| onClick, | ||
| className, | ||
| ...props | ||
| }: BannerCloseProps) => { | ||
| const { setShow } = useContext(BannerContext); | ||
|
|
||
| const handleClick: MouseEventHandler<HTMLButtonElement> = (e) => { | ||
| setShow(false); | ||
| onClick?.(e); | ||
| }; | ||
|
|
||
| return ( | ||
| <Button | ||
| className={cn( | ||
| "shrink-0 bg-transparent hover:bg-background/10 hover:text-background", | ||
| className, | ||
| )} | ||
| onClick={handleClick} | ||
| size={size} | ||
| variant={variant} | ||
| {...props} | ||
| > | ||
| <XIcon size={18} color="white" /> | ||
| </Button> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The HTML entity
should not be used in JSX text content. Use a regular space or consider using CSS for spacing control.