Add author view buttons back into video details, mobile style fixes for course and resource payment buttons

This commit is contained in:
austinkelsay 2024-10-18 14:14:17 -05:00
parent a6a1e7a2ea
commit 44f5af5061
No known key found for this signature in database
GPG Key ID: 44CB4EC6D9F2FA02
3 changed files with 37 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import { ProgressSpinner } from 'primereact/progressspinner';
import axios from 'axios';
import GenericButton from '@/components/buttons/GenericButton';
import { useRouter } from 'next/router';
import useWindowWidth from '@/hooks/useWindowWidth';
const Payment = dynamic(
() => import('@getalby/bitcoin-connect-react').then((mod) => mod.Payment),
@ -22,6 +23,8 @@ const CoursePaymentButton = ({ lnAddress, amount, onSuccess, onError, courseId }
const { data: session, status } = useSession();
const [dialogVisible, setDialogVisible] = useState(false);
const router = useRouter();
const windowWidth = useWindowWidth();
const isMobile = windowWidth < 768;
useEffect(() => {
let intervalId;
@ -121,7 +124,7 @@ const CoursePaymentButton = ({ lnAddress, amount, onSuccess, onError, courseId }
visible={dialogVisible}
onHide={() => setDialogVisible(false)}
header="Make Payment"
style={{ width: '50vw' }}
style={{ width: isMobile ? '90vw' : '50vw' }}
>
{invoice ? (
<Payment

View File

@ -8,6 +8,7 @@ import { useSession } from 'next-auth/react';
import { ProgressSpinner } from 'primereact/progressspinner';
import axios from 'axios';
import GenericButton from '@/components/buttons/GenericButton';
import useWindowWidth from '@/hooks/useWindowWidth';
import { useRouter } from 'next/router';
const Payment = dynamic(
@ -22,6 +23,8 @@ const ResourcePaymentButton = ({ lnAddress, amount, onSuccess, onError, resource
const { data: session, status } = useSession();
const [dialogVisible, setDialogVisible] = useState(false);
const router = useRouter();
const windowWidth = useWindowWidth();
const isMobile = windowWidth < 768;
useEffect(() => {
let intervalId;
@ -118,7 +121,7 @@ const ResourcePaymentButton = ({ lnAddress, amount, onSuccess, onError, resource
visible={dialogVisible}
onHide={() => setDialogVisible(false)}
header="Make Payment"
style={{ width: '50vw' }}
style={{ width: isMobile ? '90vw' : '50vw' }}
>
{invoice ? (
<Payment

View File

@ -187,6 +187,35 @@ const VideoDetails = ({ processedEvent, topics, title, summary, image, price, au
</div>
<div className="w-full flex flex-row justify-end mt-4">
{renderPaymentMessage()}
{authorView ? (
<div className='flex space-x-2 mt-4 sm:mt-0'>
<GenericButton onClick={() => router.push(`/details/${processedEvent.id}/edit`)} label="Edit" severity='warning' outlined />
<GenericButton onClick={handleDelete} label="Delete" severity='danger' outlined />
<GenericButton
tooltip={isMobileView ? null : "View Nostr Note"}
tooltipOptions={{ position: 'left' }}
icon="pi pi-external-link"
outlined
onClick={() => {
window.open(`https://nostr.com/${nAddress}`, '_blank');
}}
/>
</div>
) : (
<div className="w-full flex flex-row justify-end gap-2">
{course && <GenericButton size={isMobileView ? 'small' : 'large'} outlined icon="pi pi-external-link" onClick={() => window.open(`/course/${course}`, '_blank')} label={isMobileView ? "Course" : "Open Course"} tooltip="This is a lesson in a course" tooltipOptions={{ position: 'top' }} />}
<GenericButton
size={isMobileView ? 'small' : 'large'}
tooltip={isMobileView ? null : "View Nostr Note"}
tooltipOptions={{ position: 'left' }}
icon="pi pi-external-link"
outlined
onClick={() => {
window.open(`https://nostr.com/${nAddress}`, '_blank');
}}
/>
</div>
)}
</div>
</div>
</div>