mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-06-06 18:31:00 +00:00
Add author view buttons back into video details, mobile style fixes for course and resource payment buttons
This commit is contained in:
parent
a6a1e7a2ea
commit
44f5af5061
@ -9,6 +9,7 @@ import { ProgressSpinner } from 'primereact/progressspinner';
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import GenericButton from '@/components/buttons/GenericButton';
|
import GenericButton from '@/components/buttons/GenericButton';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
|
import useWindowWidth from '@/hooks/useWindowWidth';
|
||||||
|
|
||||||
const Payment = dynamic(
|
const Payment = dynamic(
|
||||||
() => import('@getalby/bitcoin-connect-react').then((mod) => mod.Payment),
|
() => 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 { data: session, status } = useSession();
|
||||||
const [dialogVisible, setDialogVisible] = useState(false);
|
const [dialogVisible, setDialogVisible] = useState(false);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const windowWidth = useWindowWidth();
|
||||||
|
const isMobile = windowWidth < 768;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let intervalId;
|
let intervalId;
|
||||||
@ -121,7 +124,7 @@ const CoursePaymentButton = ({ lnAddress, amount, onSuccess, onError, courseId }
|
|||||||
visible={dialogVisible}
|
visible={dialogVisible}
|
||||||
onHide={() => setDialogVisible(false)}
|
onHide={() => setDialogVisible(false)}
|
||||||
header="Make Payment"
|
header="Make Payment"
|
||||||
style={{ width: '50vw' }}
|
style={{ width: isMobile ? '90vw' : '50vw' }}
|
||||||
>
|
>
|
||||||
{invoice ? (
|
{invoice ? (
|
||||||
<Payment
|
<Payment
|
||||||
|
@ -8,6 +8,7 @@ import { useSession } from 'next-auth/react';
|
|||||||
import { ProgressSpinner } from 'primereact/progressspinner';
|
import { ProgressSpinner } from 'primereact/progressspinner';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import GenericButton from '@/components/buttons/GenericButton';
|
import GenericButton from '@/components/buttons/GenericButton';
|
||||||
|
import useWindowWidth from '@/hooks/useWindowWidth';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
|
|
||||||
const Payment = dynamic(
|
const Payment = dynamic(
|
||||||
@ -22,6 +23,8 @@ const ResourcePaymentButton = ({ lnAddress, amount, onSuccess, onError, resource
|
|||||||
const { data: session, status } = useSession();
|
const { data: session, status } = useSession();
|
||||||
const [dialogVisible, setDialogVisible] = useState(false);
|
const [dialogVisible, setDialogVisible] = useState(false);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const windowWidth = useWindowWidth();
|
||||||
|
const isMobile = windowWidth < 768;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let intervalId;
|
let intervalId;
|
||||||
@ -118,7 +121,7 @@ const ResourcePaymentButton = ({ lnAddress, amount, onSuccess, onError, resource
|
|||||||
visible={dialogVisible}
|
visible={dialogVisible}
|
||||||
onHide={() => setDialogVisible(false)}
|
onHide={() => setDialogVisible(false)}
|
||||||
header="Make Payment"
|
header="Make Payment"
|
||||||
style={{ width: '50vw' }}
|
style={{ width: isMobile ? '90vw' : '50vw' }}
|
||||||
>
|
>
|
||||||
{invoice ? (
|
{invoice ? (
|
||||||
<Payment
|
<Payment
|
||||||
|
@ -187,6 +187,35 @@ const VideoDetails = ({ processedEvent, topics, title, summary, image, price, au
|
|||||||
</div>
|
</div>
|
||||||
<div className="w-full flex flex-row justify-end mt-4">
|
<div className="w-full flex flex-row justify-end mt-4">
|
||||||
{renderPaymentMessage()}
|
{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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user