3
0
mirror of https://github.com/Qortal/q-tube.git synced 2025-02-11 17:55:51 +00:00

Merge pull request #63 from QortalSeth/main

SuperLike Form has Mobile Support
This commit is contained in:
Qortal Dev 2025-01-06 16:44:47 -07:00 committed by GitHub
commit 2728d14ed2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,6 +6,8 @@ import {
InputLabel, InputLabel,
Modal, Modal,
Tooltip, Tooltip,
useMediaQuery,
useTheme,
} from "@mui/material"; } from "@mui/material";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
@ -16,7 +18,11 @@ import {
FOR_SUPER_LIKE, FOR_SUPER_LIKE,
SUPER_LIKE_BASE, SUPER_LIKE_BASE,
} from "../../../constants/Identifiers.ts"; } from "../../../constants/Identifiers.ts";
import { minPriceSuperlike } from "../../../constants/Misc.ts"; import {
fontSizeLarge,
fontSizeMedium,
minPriceSuperlike,
} from "../../../constants/Misc.ts";
import { setNotification } from "../../../state/features/notificationsSlice.ts"; import { setNotification } from "../../../state/features/notificationsSlice.ts";
import { RootState } from "../../../state/store.ts"; import { RootState } from "../../../state/store.ts";
import BoundedNumericTextField from "../../../utils/BoundedNumericTextField.tsx"; import BoundedNumericTextField from "../../../utils/BoundedNumericTextField.tsx";
@ -173,7 +179,8 @@ export const SuperLike = ({
}); });
}, []); }, []);
const textFieldWidth = "350px"; const isScreenSmall = !useMediaQuery(`(min-width:400px)`);
const theme = useTheme();
return ( return (
<> <>
<Box <Box
@ -249,7 +256,16 @@ export const SuperLike = ({
aria-labelledby="alert-dialog-title" aria-labelledby="alert-dialog-title"
aria-describedby="alert-dialog-description" aria-describedby="alert-dialog-description"
> >
<ModalBody> <ModalBody
sx={{
width: "90%",
backgroundColor: "#A58700",
boxShadow: "none",
gap: "0px",
padding: "0px",
border: 0,
}}
>
<Box <Box
sx={{ sx={{
display: "flex", display: "flex",
@ -260,12 +276,16 @@ export const SuperLike = ({
> >
<NewCrowdfundTitle>Super Like</NewCrowdfundTitle> <NewCrowdfundTitle>Super Like</NewCrowdfundTitle>
</Box> </Box>
<DialogContent> <DialogContent sx={{ padding: "10px 12px" }}>
<Box> <Box>
<InputLabel htmlFor="standard-adornment-amount"> <InputLabel
Amount in QORT (min 1 QORT) sx={{ color: "white" }}
htmlFor="standard-adornment-amount"
>
Amount
</InputLabel> </InputLabel>
<BoundedNumericTextField <BoundedNumericTextField
addIconButtons={!isScreenSmall}
minValue={+minPriceSuperlike} minValue={+minPriceSuperlike}
initialValue={minPriceSuperlike.toString()} initialValue={minPriceSuperlike.toString()}
maxValue={numberToInt(+currentBalance)} maxValue={numberToInt(+currentBalance)}
@ -275,7 +295,11 @@ export const SuperLike = ({
value={superlikeDonationAmount} value={superlikeDonationAmount}
afterChange={(e: string) => setSuperlikeDonationAmount(+e)} afterChange={(e: string) => setSuperlikeDonationAmount(+e)}
InputProps={{ InputProps={{
style: { fontSize: 30, width: textFieldWidth }, style: {
fontSize: fontSizeMedium,
width: "80%",
border: `1px solid ${theme.palette.primary.main}`,
},
startAdornment: ( startAdornment: (
<InputAdornment position="start"> <InputAdornment position="start">
<img <img
@ -291,51 +315,68 @@ export const SuperLike = ({
}} }}
/> />
<div>Current QORT Balance is: {currentBalance}</div> <Box sx={{ display: "flex", gap: "5px", alignItems: "center" }}>
<img
style={{
height: "25px",
width: "25px",
}}
src={qortImg}
alt={"Qort Icon"}
/>
Balance: {currentBalance}
</Box>
<Spacer height="25px" /> <Spacer height="25px" />
<CommentInput <CommentInput
id="standard-multiline-flexible" id="standard-multiline-flexible"
label="Your comment" label="Comment Here"
multiline multiline
minRows={8} minRows={8}
maxRows={8} maxRows={8}
variant="filled" variant="filled"
value={comment} value={comment}
InputLabelProps={{
style: { fontSize: fontSizeMedium, color: "white" },
}}
inputProps={{ inputProps={{
maxLength: 500, maxLength: 500,
style: { fontSize: fontSizeLarge },
}} }}
InputLabelProps={{ style: { fontSize: "18px" } }}
onChange={e => setComment(e.target.value)} onChange={e => setComment(e.target.value)}
sx={{ border: `1px solid ${theme.palette.primary.main}` }}
/> />
</Box> </Box>
</DialogContent> </DialogContent>
<CrowdfundActionButtonRow> <CrowdfundActionButtonRow>
<CrowdfundActionButton
onClick={() => {
setIsOpen(false);
resetValues();
onClose();
}}
variant="contained"
color="error"
>
Cancel
</CrowdfundActionButton>
<Box <Box
sx={{ sx={{
display: "flex", display: "flex",
gap: "20px",
alignItems: "center", alignItems: "center",
justifyContent: "space-between",
margin: "10px",
width: "100%",
}} }}
> >
<CrowdfundActionButton
onClick={() => {
setIsOpen(false);
resetValues();
onClose();
}}
variant="contained"
color="error"
>
Cancel
</CrowdfundActionButton>
<CrowdfundActionButton <CrowdfundActionButton
variant="contained" variant="contained"
onClick={() => { onClick={() => {
publishSuperLike(); publishSuperLike();
}} }}
> >
Publish Super Like Publish
</CrowdfundActionButton> </CrowdfundActionButton>
</Box> </Box>
</CrowdfundActionButtonRow> </CrowdfundActionButtonRow>