Skip to content

Commit

Permalink
making proxy message better and more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
vwh committed Aug 13, 2024
1 parent ab5b79c commit a47c2c0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function App() {
<ProxyMessage
showDialog={showDialog}
setShowDialog={setShowDialog}
fn={handleRetryWithProxy}
onConfirm={handleRetryWithProxy}
/>
</main>
);
Expand Down
17 changes: 9 additions & 8 deletions src/components/landing/proxy-message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import {
interface ProxyMessageProps {
showDialog: boolean;
setShowDialog: React.Dispatch<React.SetStateAction<boolean>>;
fn: () => void;
onConfirm: () => void;
}

export default function ProxyMessage({
showDialog,
setShowDialog,
fn
onConfirm
}: ProxyMessageProps) {
const handleClose = useCallback(() => {
setShowDialog(false);
Expand All @@ -30,18 +30,19 @@ export default function ProxyMessage({
<AlertDialog open={showDialog} onOpenChange={setShowDialog}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Retry using a proxy?</AlertDialogTitle>
<AlertDialogTitle>Use Proxy to Load Database?</AlertDialogTitle>
<AlertDialogDescription>
Failed to load the database from the provided URL due to possible
CORS restrictions.
We couldn't load the database from the provided URL due to CORS
restrictions. Would you like to try using a proxy?
</AlertDialogDescription>
</AlertDialogHeader>
<div className="text-sm font-semibold">
Using the proxy may expose your database to corsproxy.io services.
<div className="font-semibold text-yellow-600 md:text-left">
Warning: Using the proxy will route your database traffic through
cors.eu.org.
</div>
<AlertDialogFooter>
<AlertDialogCancel onClick={handleClose}>Cancel</AlertDialogCancel>
<AlertDialogAction onClick={fn}>Confirm</AlertDialogAction>
<AlertDialogAction onClick={onConfirm}>Use Proxy</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
Expand Down
8 changes: 1 addition & 7 deletions src/components/ui/alert-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,7 @@ const AlertDialogHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col space-y-2 text-center sm:text-left",
className
)}
{...props}
/>
<div className={cn("flex flex-col space-y-2", className)} {...props} />
);
AlertDialogHeader.displayName = "AlertDialogHeader";

Expand Down

0 comments on commit a47c2c0

Please sign in to comment.