Merge pull request #5 from peakshift/push-to-launch

Some updates for launch
This commit is contained in:
Mohammed Taher Ghazal
2022-02-08 16:44:53 +02:00
committed by GitHub
11 changed files with 13034 additions and 8785 deletions

View File

@@ -206,7 +206,7 @@ module.exports = {
await context.prisma.project.update({
where: { id: project.id },
data: {
votes_count: (project.votes_count = vote.amount_in_sat),
votes_count: project.votes_count + vote.amount_in_sat,
},
});
// return the current vote

21759
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -107,7 +107,7 @@
"@types/react-copy-to-clipboard": "^5.0.2",
"autoprefixer": "^9.8.8",
"gh-pages": "^3.2.3",
"netlify-cli": "^8.0.3",
"netlify-cli": "^8.15.0",
"postcss": "^7.0.39",
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17"
}

View File

@@ -22,6 +22,7 @@ type Props = {
export default function TipButton({ onTip = () => { }, ...props }: Props) {
const [tipCnt, setTipCnt] = useState(0)
const [incStep, setIncStep] = useState(10)
const [sparks, setSparks] = useState<Particle[]>([]);
const [wasActive, setWasActive] = useState(false);
@@ -53,8 +54,9 @@ export default function TipButton({ onTip = () => { }, ...props }: Props) {
const { onPressDown, onPressUp } = usePressHolder(_throttle(() => {
const incStep = (Math.ceil((tipCnt + 1) / 100) + 1) ** 2;
setTipCnt(s => s + incStep)
const _incStep = (Math.ceil((tipCnt + 1) / 10) + 1) ** 2 * 10;
setIncStep(_incStep)
setTipCnt(s => { console.log('update'); return s + _incStep})
const newSpark = {
id: Math.random().toString(),
@@ -84,7 +86,6 @@ export default function TipButton({ onTip = () => { }, ...props }: Props) {
}
const handlePressUp = (event?: any) => {
if (!wasActive) return;
setWasActive(false);
@@ -95,9 +96,9 @@ export default function TipButton({ onTip = () => { }, ...props }: Props) {
else
setTimeout(() => {
setSparks([]);
onTip(tipCnt);
onTip(tipCnt + incStep); // somehow we always miss one incStep
setTipCnt(0);
}, 1000)
}, 500)
}
return (
@@ -116,7 +117,7 @@ export default function TipButton({ onTip = () => { }, ...props }: Props) {
} as any}
{...props}
>
Hold To Tip !!! <MdLocalFireDepartment className='text-fire' />
Hold To Vote !!! <MdLocalFireDepartment className='text-fire' />
<span
className='tip-counter'

View File

@@ -11,7 +11,8 @@ import App from './App';
import reportWebVitals from './reportWebVitals';
const client = new ApolloClient({
uri: 'https://xenodochial-goldstine-d09942.netlify.app/.netlify/functions/graphql',
//uri: 'https://xenodochial-goldstine-d09942.netlify.app/.netlify/functions/graphql',
uri: '/.netlify/functions/graphql',
cache: new InMemoryCache()
});

View File

@@ -17,6 +17,8 @@ export default function Categories() {
)}
</div>
return (<div></div>)
/*
return (
<Slider>
{data?.allCategories.map(category =>
@@ -24,4 +26,5 @@ export default function Categories() {
)}
</Slider>
)
*/
}

View File

@@ -18,7 +18,7 @@ export default function ProjectsSection() {
return (
<div className='mt-32 lg:mt-48'>
<ProjectsRow title={<>Hottest <MdLocalFireDepartment className='inline-block text-fire align-bottom scale-125 origin-bottom' /></>}
<ProjectsRow title={<>Newest <MdLocalFireDepartment className='inline-block text-fire align-bottom scale-125 origin-bottom' /></>}
categoryId="133123"
projects={data.newProjects} />
{data.allCategories.map(({ id, title, project, }) => {

View File

@@ -96,7 +96,7 @@ export default function ProjectCard({ onClose, direction, projectId, ...props }:
</div>
</div>
<div className="flex-shrink-0 hidden md:flex ml-auto gap-16">
{/* <Button color='primary' size='md' className=" my-16">Play <BsJoystick /></Button> */}
<Button color='primary' size='md' className=" my-16" onClick={() => { window.open(project?.website)} }>Visit <BsJoystick /></Button>
{isWalletConnected ?
<TipButton onTip={onTip} />
:
@@ -106,7 +106,7 @@ export default function ProjectCard({ onClose, direction, projectId, ...props }:
</div>
<p className="mt-40 text-body4 leading-normal">{project?.description}</p>
<div className="md:hidden">
{/* <Button color='primary' size='md' fullWidth className="w-full mt-24 mb-16">Play <BsJoystick /></Button> */}
<Button color='primary' size='md' fullWidth onClick={() => { window.open(project?.website)} } className="w-full mt-24 mb-16">Visit <BsJoystick /></Button>
{isWalletConnected ?
<TipButton fullWidth onTip={onTip} />
:

View File

@@ -10,9 +10,9 @@ import Confetti from "react-confetti";
import { Wallet_Service } from 'src/services';
const defaultOptions = [
{ text: '10 sat', value: 10 },
{ text: '100 sats', value: 100 },
{ text: '1k sats', value: 1000 },
{ text: '100 sat', value: 100 },
{ text: '1k sat', value: 1000 },
{ text: '10k sats', value: 10000 },
]
@@ -81,11 +81,11 @@ export default function TipCard({ onClose, direction, tipValue, ...props }: Prop
preimage: paymentResponse.preimage
}
})
.catch() // ONLY TEMPROARY !!! SHOULD BE FIXED FROM BACKEND
.catch((e) => { console.log(e); }) // ONLY TEMPROARY !!! SHOULD BE FIXED FROM BACKEND
.finally(() => {
setTimeout(() => {
onClose?.();
}, 2000);
}, 4000);
})
} catch (error) {
@@ -101,7 +101,7 @@ export default function TipCard({ onClose, direction, tipValue, ...props }: Prop
setPaymentStatus(PaymentStatus.PAYMENT_CONFIRMED);
setTimeout(() => {
onClose?.();
}, 2000);
}, 4000);
},
onError: () => { }
@@ -132,7 +132,7 @@ export default function TipCard({ onClose, direction, tipValue, ...props }: Prop
className="modal-card max-w-[343px] p-24 rounded-xl relative"
>
<IoClose className='absolute text-body2 top-24 right-24 hover:cursor-pointer' onClick={onClose} />
<h2 className='text-h5 font-bold'>Tip this Project</h2>
<h2 className='text-h5 font-bold'>Vote for this Project</h2>
<div className="mt-32 ">
<label className="block text-gray-700 text-body4 mb-2 ">
Enter Amount
@@ -157,13 +157,13 @@ export default function TipCard({ onClose, direction, tipValue, ...props }: Prop
)}
</div>
<p className="text-body6 mt-12 text-gray-500">1 sat = 1 vote</p>
{paymentStatus === PaymentStatus.FETCHING_PAYMENT_DETAILS && <p className="text-body6 mt-12 text-gray-500">Please wait while we the fetch payment details.</p>}
{paymentStatus === PaymentStatus.FETCHING_PAYMENT_DETAILS && <p className="text-body6 mt-12 text-yellow-500">Please wait while we the fetch payment details.</p>}
{paymentStatus === PaymentStatus.NOT_PAID && <p className="text-body6 mt-12 text-red-500">You did not confirm the payment. Please try again.</p>}
{paymentStatus === PaymentStatus.PAID && <p className="text-body6 mt-12 text-green-500">The invoice was paid! Please wait while we confirm it.</p>}
{paymentStatus === PaymentStatus.AWAITING_PAYMENT && <p className="text-body6 mt-12 text-yellow-500">Please confirm the payment in the prompt...</p>}
{paymentStatus === PaymentStatus.PAYMENT_CONFIRMED && <p className="text-body6 mt-12 text-green-500">Imagine confetti here</p>}
<button className="btn btn-primary w-full mt-32" onClick={requestPayment}>
Tip
{paymentStatus === PaymentStatus.AWAITING_PAYMENT && <p className="text-body6 mt-12 text-yellow-500">Waiting for your payment...</p>}
{paymentStatus === PaymentStatus.PAYMENT_CONFIRMED && <p className="text-body6 mt-12 text-green-500">Thanks for your vote</p>}
<button className="btn btn-primary w-full mt-32" disabled={paymentStatus !== PaymentStatus.DEFAULT && paymentStatus !== PaymentStatus.NOT_PAID} onClick={requestPayment}>
{paymentStatus === PaymentStatus.DEFAULT || paymentStatus === PaymentStatus.NOT_PAID ? "Vote" : "Voting..."}
</button>
</div>
{paymentStatus === PaymentStatus.PAYMENT_CONFIRMED && <Confetti width={width} height={height} />}

View File

@@ -29,10 +29,10 @@ class _Wallet_Service {
}
catch (err: any) {
// Default error message
let message = `Couldn't connect wallet`;
let message = "Check out https://getalby.com to get a web enabled lightning wallet";
// If they didn't have a provider, point them to Joule
if (err.constructor === MissingProviderError) {
message = "Check out https://lightningjoule.com to get a WebLN provider";
message = "Check out https://getalby.com to get a web enabled lightning wallet";
}

View File

@@ -15,7 +15,8 @@ import {
} from "@apollo/client";
const client = new ApolloClient({
uri: 'https://deploy-preview-2--makers-bolt-fun.netlify.app/.netlify/functions/graphql',
//uri: 'https://deploy-preview-2--makers-bolt-fun.netlify.app/.netlify/functions/graphql',
uri: '/.netlify/functions/graphql',
cache: new InMemoryCache()
});