Skip to content

Commit

Permalink
Merge pull request #51 from interledger/50-payment-choice-page
Browse files Browse the repository at this point in the history
Add payment choice page
  • Loading branch information
Tymmmy authored Jan 28, 2025
2 parents 7c215fc + 2e72d59 commit f3e55fa
Show file tree
Hide file tree
Showing 3 changed files with 201 additions and 0 deletions.
33 changes: 33 additions & 0 deletions app/components/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,36 @@ export const Share = (props: SVGProps<SVGSVGElement>) => {
</svg>
)
}

export const Card = (props: SVGProps<SVGSVGElement>) => {
return (
<svg
width="30"
height="26"
viewBox="0 0 20 16"
fill="none"
stroke="currentColor"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<path
d="M1 5H19"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M7.57 9H5"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M16 15H4C2.343 15 1 13.657 1 12V4C1 2.343 2.343 1 4 1H16C17.657 1 19 2.343 19 4V12C19 13.657 17.657 15 16 15Z"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
)
}
97 changes: 97 additions & 0 deletions app/components/ui/logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,100 @@ export const PayWithInterledgerMark = (props: SVGProps<SVGSVGElement>) => {
</svg>
)
}

export const InterledgerMark = (props: SVGProps<SVGSVGElement>) => {
return (
<svg
width="30"
height="30"
viewBox="0 0 293 290"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M11.5523 191.915C-1.65764 163.582 -3.60868 131.585 6.06085 101.835C15.6352 72.3787 35.7642 47.7861 62.736 32.5966L66.0005 38.4021C40.4847 52.7732 21.4502 76.0333 12.3898 103.9C3.24374 132.042 5.09008 162.298 17.5862 189.108L11.5523 191.925V191.915Z"
fill="#222222"
/>
<path
d="M131.907 290C106.039 290 80.8378 281.863 59.6429 266.464C34.584 248.257 17.4149 221.514 11.3048 191.163L17.8336 189.85C23.6106 218.554 39.8565 243.851 63.5545 261.068C87.4904 278.456 116.842 286.05 146.193 282.453L147.002 289.067C141.958 289.686 136.913 289.991 131.898 289.991L131.907 290Z"
fill="#222222"
/>
<path
d="M160.488 289.905C155.748 289.905 150.989 289.629 146.231 289.077L147.002 282.462C176.086 285.832 205.162 278.208 228.869 260.982C252.805 243.594 269.098 218.021 274.742 188.994L281.28 190.269C275.313 220.962 258.087 247.991 232.781 266.378C211.605 281.768 186.365 289.905 160.497 289.905H160.488Z"
fill="#222222"
/>
<path
d="M281.033 191.021L274.98 188.242C287.172 161.622 288.904 131.614 279.853 103.747C270.707 75.605 251.425 52.2116 225.567 37.8691L228.793 32.0446C256.136 47.2055 276.522 71.9409 286.182 101.692C295.756 131.157 293.929 162.878 281.033 191.021Z"
fill="#222222"
/>
<path
d="M66.6381 37.9357L62.0984 33.0629C84.9683 11.7443 114.786 0 146.069 0C177.352 0 206.646 11.5444 229.431 32.5014L224.919 37.4028C203.372 17.5784 175.363 6.66207 146.069 6.66207C116.775 6.66207 88.2708 17.7687 66.6381 37.9357Z"
fill="#222222"
/>
<path
d="M71.5585 251.731C45.1862 239.597 23.8676 218.354 11.5523 191.915L11.381 191.554L11.3048 191.163C5.54689 162.564 10.1056 132.813 24.1436 107.393L29.9777 110.609C16.7677 134.526 12.4279 162.516 17.7575 189.45C29.4447 214.29 49.5261 234.238 74.3471 245.669L71.5585 251.722V251.731Z"
fill="#222222"
/>
<path
d="M146.621 289.125L146.231 289.077C117.251 285.717 90.3647 272.184 70.5308 250.979L75.3941 246.43C94.0574 266.388 119.335 279.16 146.602 282.415C173.831 278.979 199.014 266.045 217.553 245.964L222.445 250.485C202.754 271.822 175.963 285.527 147.011 289.077L146.621 289.125Z"
fill="#222222"
/>
<path
d="M221.408 251.236L218.581 245.202C243.336 233.62 263.284 213.519 274.809 188.603C279.958 161.641 275.437 133.689 262.075 109.858L267.89 106.603C282.09 131.928 286.848 161.641 281.281 190.269L281.205 190.659L281.043 191.021C268.889 217.545 247.713 238.93 221.417 251.246L221.408 251.236Z"
fill="#222222"
/>
<path
d="M30.368 109.401L23.7535 108.62C27.1512 79.7831 40.7609 52.954 62.0985 33.063L62.3936 32.787L62.7362 32.5871C88.1567 18.2732 117.86 13.4099 146.374 18.9108L145.108 25.4492C118.269 20.2718 90.3172 24.802 66.3527 38.1928C46.338 56.9798 33.5658 82.2481 30.3775 109.382L30.368 109.401Z"
fill="#222222"
/>
<path
d="M261.665 108.639C258.296 81.5248 245.353 56.3326 225.205 37.6788C201.155 24.4498 173.174 20.11 146.383 25.4587L145.079 18.9203C173.555 13.2385 203.277 17.8925 228.783 32.0351L229.136 32.2254L229.431 32.4919C250.901 52.2497 264.702 78.9932 268.28 107.811L261.665 108.63V108.639Z"
fill="#222222"
/>
<path
d="M123.294 263.076C110.398 263.076 97.5025 261.049 85.1301 257.032C80.5142 255.529 75.9459 253.749 71.5585 251.731L70.9684 251.455L70.5211 250.979C67.0378 247.258 63.7448 243.27 60.7374 239.121C48.5172 222.304 40.7131 202.584 38.153 182.084L44.7674 181.256C47.1848 200.643 54.5702 219.296 66.1241 235.2C68.8461 238.95 71.8059 242.557 74.9371 245.945C78.9058 247.743 83.0268 249.342 87.1858 250.694C106.144 256.851 126.425 258.06 145.85 254.187L147.154 260.725C139.293 262.295 131.289 263.076 123.285 263.076H123.294Z"
fill="#222222"
/>
<path
d="M168.939 262.923C161.211 262.923 153.483 262.2 145.879 260.734L147.135 254.196C166.322 257.889 186.346 256.623 205.048 250.551C209.454 249.123 213.803 247.42 217.991 245.488C220.932 242.261 223.72 238.845 226.29 235.304C238.006 219.182 245.42 200.262 247.742 180.59L254.356 181.37C251.901 202.175 244.059 222.18 231.677 239.225C228.822 243.146 225.719 246.944 222.436 250.494L221.988 250.97L221.398 251.246C216.782 253.406 211.967 255.309 207.094 256.889C194.74 260.906 181.825 262.933 168.93 262.933L168.939 262.923Z"
fill="#222222"
/>
<path
d="M38.5527 183.302C28.3122 165.029 22.8969 144.234 22.8969 123.172C22.8969 118.328 23.1824 113.426 23.7534 108.63L23.8295 107.983L24.1436 107.412C26.6086 102.948 29.3876 98.5796 32.3951 94.4396C44.6152 77.6226 60.9563 64.1081 79.6672 55.3332L82.4938 61.3671C64.8013 69.6566 49.3453 82.4478 37.7818 98.3511C35.0599 102.091 32.5473 106.032 30.2918 110.057C29.8064 114.397 29.5589 118.804 29.5589 123.172C29.5589 143.101 34.6792 162.773 44.3582 180.047L38.5432 183.302H38.5527Z"
fill="#222222"
/>
<path
d="M83.5216 60.6058L78.6298 56.0851C92.839 40.6958 110.941 29.1228 130.984 22.613C135.59 21.1188 140.34 19.872 145.079 18.9298L145.717 18.8061L146.354 18.9298C151.37 19.9006 156.376 21.1854 161.239 22.7653C181.007 29.1894 198.918 40.553 213.032 55.6378L208.169 60.1871C194.816 45.9207 177.876 35.1758 159.174 29.0942C154.777 27.6666 150.257 26.4865 145.726 25.5824C141.453 26.458 137.18 27.5905 133.021 28.942C114.062 35.0996 96.9409 46.0445 83.5026 60.5963L83.5216 60.6058Z"
fill="#222222"
/>
<path
d="M253.966 182.588L248.132 179.371C257.573 162.269 262.56 142.835 262.56 123.172C262.56 118.547 262.284 113.883 261.741 109.296C259.581 105.499 257.192 101.787 254.623 98.256C242.907 82.1337 227.203 69.2284 209.216 60.9388L212.004 54.8859C231.029 63.6512 247.627 77.2895 260.009 94.3349C262.855 98.256 265.501 102.386 267.871 106.603L268.194 107.174L268.27 107.821C268.898 112.884 269.222 118.052 269.222 123.163C269.222 143.948 263.95 164.496 253.966 182.579V182.588Z"
fill="#222222"
/>
<path
d="M146.516 260.858L145.879 260.735C123.38 256.404 102.556 245.926 85.6726 230.432L90.1743 225.521C105.992 240.035 125.455 249.895 146.497 254.073C167.521 249.761 186.917 239.768 202.64 225.15L207.179 230.022C190.4 245.631 169.643 256.252 147.164 260.735L146.526 260.858H146.516Z"
fill="#222222"
/>
<path
d="M86.3008 230.888C66.267 219.753 49.7546 203.298 38.5528 183.302L38.2292 182.731L38.1531 182.084C35.3169 159.347 38.8478 136.306 48.3746 115.454L54.4371 118.223C45.5194 137.753 42.1503 159.309 44.6914 180.609C55.2841 199.272 70.7877 214.633 89.5462 225.064L86.3103 230.888H86.3008Z"
fill="#222222"
/>
<path
d="M54.6655 117.481L48.1272 116.206C52.5242 93.7163 63.0788 72.9211 78.63 56.0851L79.0773 55.6092L79.6673 55.3332C100.415 45.6066 123.418 41.8473 146.193 44.4645L145.432 51.0885C124.103 48.6426 102.566 52.0974 83.084 61.1007C68.6083 76.9469 58.796 96.4287 54.6655 117.5V117.481Z"
fill="#222222"
/>
<path
d="M237.416 116.872C233.152 95.8291 223.206 76.4139 208.626 60.6724C189.087 51.8023 167.521 48.4903 146.212 51.079L145.412 44.4645C168.168 41.695 191.2 45.3021 212.014 54.8954L212.604 55.1714L213.051 55.6473C228.717 72.3786 239.395 93.0977 243.944 115.558L237.416 116.881V116.872Z"
fill="#222222"
/>
<path
d="M206.542 230.479L203.268 224.673C221.96 214.119 237.349 198.653 247.818 179.933C250.216 158.605 246.705 137.077 237.654 117.604L243.697 114.797C253.357 135.583 257.04 158.605 254.356 181.36L254.28 182.008L253.966 182.579C242.898 202.641 226.499 219.201 206.542 230.479Z"
fill="#222222"
/>
<path
d="M146.06 246.335C125.141 246.335 104.479 240.996 86.3008 230.888L85.9582 230.698L85.6727 230.431C70.1405 216.175 58.4629 197.978 51.915 177.811C45.4528 157.91 44.1489 136.61 48.1366 116.205L48.2128 115.815L48.3746 115.454C57.1304 96.2763 70.8353 79.545 87.9854 67.0869C104.907 54.7907 124.77 46.9675 145.412 44.4549L145.803 44.4073L146.193 44.4549C167.14 46.8628 187.279 54.7145 204.438 67.1821C221.36 79.4784 234.941 95.9432 243.707 114.806L243.868 115.168L243.944 115.558C248.132 136.22 246.885 157.805 240.328 177.972C233.866 197.863 222.397 215.87 207.17 230.032L206.884 230.298L206.542 230.489C188.183 240.853 167.274 246.335 146.06 246.335ZM89.8793 225.254C106.982 234.686 126.397 239.673 146.06 239.673C165.722 239.673 185.642 234.562 202.916 224.883C217.172 211.53 227.908 194.609 233.989 175.907C240.147 156.958 241.356 136.687 237.492 117.262C229.202 99.5788 216.421 84.1323 200.517 72.5784C184.395 60.8627 165.494 53.4487 145.822 51.1265C126.435 53.5534 107.8 60.9293 91.8969 72.4832C75.7747 84.199 62.8789 99.8834 54.5893 117.871C50.9062 137.058 52.1624 157.063 58.244 175.755C64.4016 194.704 75.3369 211.816 89.8888 225.264L89.8793 225.254Z"
fill="#222222"
/>
</svg>
)
}
71 changes: 71 additions & 0 deletions app/routes/payment-choice.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { Header } from '~/components/header'
import { Link, useLoaderData } from '@remix-run/react'
import { BackNav, Card } from '~/components/icons'
import { json, redirect, type LoaderFunctionArgs } from '@remix-run/node'
import { destroySession, getSession } from '~/session'
import { getValidWalletAddress } from '~/lib/validators.server'
import { InterledgerMark } from '~/components/ui/logo'

export async function loader({ request }: LoaderFunctionArgs) {
const searchParams = new URL(request.url).searchParams
const receiver = searchParams.get('receiver') || ''
const session = await getSession(request.headers.get('Cookie'))

if (receiver !== '') {
try {
await getValidWalletAddress(receiver)
} catch (error) {
throw new Error(
'Receiver Wallet Address is not valid. Please check and try again.'
)
}
} else {
return redirect('/', {
headers: { 'Set-Cookie': await destroySession(session) }
})
}

return json({
receiver: receiver
} as const)
}

export default function PaymentChoice() {
const data = useLoaderData<typeof loader>()

return (
<>
<Header />
<Link to="/" className="flex gap-2 items-center justify-end">
<BackNav />
<span className="hover:text-green-1">Home</span>
</Link>
<div className="flex sm:justify-center items-center sm:items-start mt-20 flex-col w-full gap-10 sm:flex-row h-full px-5">
<Link
to={`/pay-with-interledger?receiver=${data.receiver}`}
className={`w-56 h-32 text-right ease-in-out transition-[box-shadow,transform] duration-200 aspect-[5/3] rounded-lg flex flex-col p-3 border-2
hover:scale-105 focus:scale-105 hover:bg-green-2 hover:border-green-2`}
>
<span className="h-8 flex justify-end text-green-1">
<InterledgerMark />
</span>
<span className="text-md mt-10 font-semibold -tracking-wider text-green-1 text-2xl">
Pay with Interledger
</span>
</Link>
<Link
to={`/checkout?receiver=${data.receiver}`}
className={`w-56 h-32 text-right ease-in-out transition-[box-shadow,transform] duration-200 aspect-[5/3] rounded-lg flex flex-col p-3 border-2
hover:scale-105 focus:scale-105 hover:bg-green-2 hover:border-green-2`}
>
<span className="h-8 flex justify-end text-[#222222]">
<Card />
</span>
<span className="text-md mt-10 font-semibold -tracking-wider text-green-1 text-2xl">
Pay with card
</span>
</Link>
</div>
</>
)
}

0 comments on commit f3e55fa

Please sign in to comment.