Skip to content

Commit

Permalink
added share button
Browse files Browse the repository at this point in the history
  • Loading branch information
Nutlope committed Sep 22, 2023
1 parent 3b7bf2a commit aada837
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

## Todos v1.5

- [ ] Add share button on the dynamic page. Replace generate with "regenerate" when user has pic on the screen, then add share button where regenerate is now
- [ ] Setup README and Vercel template
21 changes: 18 additions & 3 deletions components/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import downloadQrCode from '@/utils/downloadQrCode';
import va from '@vercel/analytics';
import { PromptSuggestion } from '@/components/PromptSuggestion';
import { useRouter } from 'next/navigation';
import { toast, Toaster } from 'react-hot-toast';

const promptSuggestions = [
'A city view with clouds',
Expand Down Expand Up @@ -201,7 +202,13 @@ const Body = ({
className="inline-flex justify-center
max-w-[200px] mx-auto w-full"
>
{isLoading ? <LoadingDots color="white" /> : 'Generate'}
{isLoading ? (
<LoadingDots color="white" />
) : response ? (
'✨ Regenerate'
) : (
'Generate'
)}
</Button>

{error && (
Expand Down Expand Up @@ -243,9 +250,16 @@ const Body = ({
</Button>
<Button
variant="outline"
onClick={form.handleSubmit(handleSubmit)}
onClick={() => {
navigator.clipboard.writeText(
`https://qrgpt.io/start/${id || ''}`,
);
toast('Bio copied to clipboard', {
icon: '✂️',
});
}}
>
✨ Regenerate
✂️ Share
</Button>
</div>
)}
Expand All @@ -254,6 +268,7 @@ const Body = ({
)}
</div>
</div>
<Toaster />
</div>
);
};
Expand Down
24 changes: 24 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.46.1",
"react-hot-toast": "^2.4.1",
"replicate": "^0.18.0",
"tailwind-merge": "^1.14.0",
"tailwindcss": "3.3.3",
Expand Down

0 comments on commit aada837

Please sign in to comment.