feat(hackathon): winner certificate (#73)
* update hackathon landing page * feat(hackathon): draft winner certificate * feat(hackathon): refine winner certificate
This commit is contained in:
1 parent
38ee9a9549
commit
fe172cc128
6 files changed
+1040
-18
No files matched your search
@@ -0,0 +1,132 @@
|
||||
<svg width="842" height="595" viewBox="0 0 842 595" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g clip-path="url(#clip0_2006_114)">
|
||||
<rect width="595" height="842" transform="translate(842 6.10352e-05) rotate(90)" fill="white"/>
|
||||
<line x1="842.5" y1="3.00006" x2="-10.4999" y2="3.00006" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="28.0001" x2="-10.4999" y2="28.0001" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="53.0001" x2="-10.4999" y2="53.0001" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="78.0001" x2="-10.4999" y2="78.0001" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="103" x2="-10.4999" y2="103" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="128" x2="-10.4999" y2="128" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="153" x2="-10.4999" y2="153" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="178" x2="-10.4999" y2="178" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="203" x2="-10.4999" y2="203" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="228" x2="-10.4999" y2="228" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="253" x2="-10.4999" y2="253" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="278" x2="-10.4999" y2="278" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="303" x2="-10.4999" y2="303" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="328" x2="-10.4999" y2="328" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="353" x2="-10.4999" y2="353" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="378" x2="-10.4999" y2="378" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="403" x2="-10.4999" y2="403" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="428" x2="-10.4999" y2="428" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="453" x2="-10.4999" y2="453" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="478" x2="-10.4999" y2="478" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="503" x2="-10.4999" y2="503" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="528" x2="-10.4999" y2="528" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="553" x2="-10.4999" y2="553" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="842.5" y1="578" x2="-10.4999" y2="578" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="0.500026" y1="-0.499939" x2="0.500052" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="24.5" y1="-0.499939" x2="24.5001" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="48.5" y1="-0.499939" x2="48.5001" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="72.5001" y1="-0.499939" x2="72.5002" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="96.5001" y1="-0.499939" x2="96.5002" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="120.5" y1="-0.499939" x2="120.5" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="144.5" y1="-0.499939" x2="144.5" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="168.5" y1="-0.499939" x2="168.5" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="192.5" y1="-0.499939" x2="192.5" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="216.5" y1="-0.499939" x2="216.5" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="240.5" y1="-0.499939" x2="240.5" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="264.5" y1="-0.499939" x2="264.5" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="288.5" y1="-0.499939" x2="288.5" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="312.5" y1="-0.499939" x2="312.5" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="336.5" y1="-0.499939" x2="336.5" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="360.501" y1="-0.499939" x2="360.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="384.501" y1="-0.499939" x2="384.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="408.501" y1="-0.499939" x2="408.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="432.501" y1="-0.499939" x2="432.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="456.501" y1="-0.499939" x2="456.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="480.501" y1="-0.499939" x2="480.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="504.501" y1="-0.499939" x2="504.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="528.501" y1="-0.499939" x2="528.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="552.501" y1="-0.499939" x2="552.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="576.501" y1="-0.499939" x2="576.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="600.501" y1="-0.499939" x2="600.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="624.501" y1="-0.499939" x2="624.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="648.501" y1="-0.499939" x2="648.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="672.501" y1="-0.499939" x2="672.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="696.501" y1="-0.499939" x2="696.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="720.501" y1="-0.499939" x2="720.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="744.501" y1="-0.499939" x2="744.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="768.501" y1="-0.499939" x2="768.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="792.501" y1="-0.499939" x2="792.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="816.501" y1="-0.499939" x2="816.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<line x1="840.501" y1="-0.499939" x2="840.501" y2="595.501" stroke="#F4FBFF" stroke-width="2"/>
|
||||
<g opacity="0.4" filter="url(#filter0_f_2006_114)">
|
||||
<circle cx="12.5" cy="691.5" r="159" fill="#26A5EE"/>
|
||||
</g>
|
||||
<g filter="url(#filter1_f_2006_114)">
|
||||
<circle cx="744" cy="607" r="159" fill="#26A5EE"/>
|
||||
</g>
|
||||
<g filter="url(#filter2_f_2006_114)">
|
||||
<circle cx="80.5" cy="-22.4999" r="159" fill="white"/>
|
||||
</g>
|
||||
<rect x="30.5" y="40.5001" width="236" height="53" fill="url(#pattern0_2006_114)"/>
|
||||
<rect x="275.5" y="127.5" width="37" height="251" rx="13.5" transform="rotate(90 275.5 127.5)" fill="url(#paint0_linear_2006_114)"/>
|
||||
<rect x="275.5" y="127.5" width="37" height="251" rx="13.5" transform="rotate(90 275.5 127.5)" stroke="#E1ECFC"/>
|
||||
<path d="M42.2 153.14C41.2267 153.14 40.3467 152.973 39.56 152.64C38.7867 152.307 38.1734 151.827 37.72 151.2C37.2667 150.573 37.0334 149.833 37.02 148.98H40.02C40.06 149.553 40.26 150.007 40.62 150.34C40.9934 150.673 41.5 150.84 42.14 150.84C42.7934 150.84 43.3067 150.687 43.68 150.38C44.0534 150.06 44.24 149.647 44.24 149.14C44.24 148.727 44.1134 148.387 43.86 148.12C43.6067 147.853 43.2867 147.647 42.9 147.5C42.5267 147.34 42.0067 147.167 41.34 146.98C40.4334 146.713 39.6934 146.453 39.12 14Line truncated
|
||||
<path d="M36.54 195.6C38.02 195.6 39.3134 195.887 40.42 196.46C41.54 197.02 42.4 197.833 43 198.9C43.6134 199.953 43.92 201.187 43.92 202.6C43.92 204.013 43.6134 205.24 43 206.28C42.4 207.32 41.54 208.12 40.42 208.68C39.3134 209.227 38.02 209.5 36.54 209.5H32V195.6H36.54ZM36.54 207.64C38.1667 207.64 39.4134 207.2 40.28 206.32C41.1467 205.44 41.58 204.2 41.58 202.6C41.58 200.987 41.1467 199.727 40.28 198.82C39.4134 197.913 38.1667 197.46 36.54 197.46H34.28V207.64H36.54ZM46.9397 197.02C46.5264 19Line truncated
|
||||
<path d="M606.364 497.5L603.9 493.148H602.844V497.5H600.604V486.332H604.796C605.66 486.332 606.396 486.487 607.004 486.796C607.612 487.095 608.065 487.505 608.364 488.028C608.673 488.54 608.828 489.116 608.828 489.756C608.828 490.492 608.615 491.159 608.188 491.756C607.761 492.343 607.127 492.748 606.284 492.972L608.956 497.5H606.364ZM602.844 491.468H604.716C605.324 491.468 605.777 491.324 606.076 491.036C606.375 490.737 606.524 490.327 606.524 489.804C606.524 489.292 606.375 488.897 606.076 48Line truncated
|
||||
<path d="M599.944 511.312C599.944 510.496 600.132 509.764 600.508 509.116C600.892 508.468 601.408 507.964 602.056 507.604C602.712 507.236 603.428 507.052 604.204 507.052C605.092 507.052 605.88 507.272 606.568 507.712C607.264 508.144 607.768 508.76 608.08 509.56H606.436C606.22 509.12 605.92 508.792 605.536 508.576C605.152 508.36 604.708 508.252 604.204 508.252C603.652 508.252 603.16 508.376 602.728 508.624C602.296 508.872 601.956 509.228 601.708 509.692C601.468 510.156 601.348 510.696 601.348 51Line truncated
|
||||
<path d="M400.452 495.372H396.004L395.268 497.5H392.916L396.932 486.316H399.54L403.556 497.5H401.188L400.452 495.372ZM399.844 493.58L398.228 488.908L396.612 493.58H399.844ZM406.977 485.66V497.5H404.737V485.66H406.977ZM410.006 487.58C409.612 487.58 409.281 487.457 409.014 487.212C408.758 486.956 408.63 486.641 408.63 486.268C408.63 485.895 408.758 485.585 409.014 485.34C409.281 485.084 409.612 484.956 410.006 484.956C410.401 484.956 410.726 485.084 410.982 485.34C411.249 485.585 411.382 485.895 Line truncated
|
||||
<path d="M392.944 511.312C392.944 510.496 393.132 509.764 393.508 509.116C393.892 508.468 394.408 507.964 395.056 507.604C395.712 507.236 396.428 507.052 397.204 507.052C398.092 507.052 398.88 507.272 399.568 507.712C400.264 508.144 400.768 508.76 401.08 509.56H399.436C399.22 509.12 398.92 508.792 398.536 508.576C398.152 508.36 397.708 508.252 397.204 508.252C396.652 508.252 396.16 508.376 395.728 508.624C395.296 508.872 394.956 509.228 394.708 509.692C394.468 510.156 394.348 510.696 394.348 51Line truncated
|
||||
<path d="M284.868 486.332V497.5H282.628V492.748H277.844V497.5H275.604V486.332H277.844V490.924H282.628V486.332H284.868ZM286.177 493.036C286.177 492.14 286.353 491.345 286.705 490.652C287.067 489.959 287.553 489.425 288.161 489.052C288.779 488.679 289.467 488.492 290.225 488.492C290.886 488.492 291.462 488.625 291.953 488.892C292.454 489.159 292.854 489.495 293.153 489.9V488.636H295.409V497.5H293.153V496.204C292.865 496.62 292.465 496.967 291.953 497.244C291.451 497.511 290.87 497.644 290.209 497Line truncated
|
||||
<path d="M280.428 513.796H276.936L276.336 515.5H274.908L277.896 507.148H279.48L282.468 515.5H281.028L280.428 513.796ZM280.044 512.68L278.688 508.804L277.32 512.68H280.044ZM283.071 512.164C283.071 511.5 283.207 510.912 283.479 510.4C283.759 509.888 284.135 509.492 284.607 509.212C285.087 508.924 285.619 508.78 286.203 508.78C286.635 508.78 287.059 508.876 287.475 509.068C287.899 509.252 288.235 509.5 288.483 509.812V506.62H289.863V515.5H288.483V514.504C288.259 514.824 287.947 515.088 287.547 515Line truncated
|
||||
<path d="M43.78 486.332V497.5H41.54V490.236L38.548 497.5H36.852L33.844 490.236V497.5H31.604V486.332H34.148L37.7 494.636L41.252 486.332H43.78ZM54.0427 488.636V497.5H51.7867V496.38C51.4987 496.764 51.12 497.068 50.6507 497.292C50.192 497.505 49.6907 497.612 49.1467 497.612C48.4533 497.612 47.84 497.468 47.3067 497.18C46.7733 496.881 46.352 496.449 46.0427 495.884C45.744 495.308 45.5947 494.625 45.5947 493.836V488.636H47.8347V493.516C47.8347 494.22 48.0107 494.764 48.3627 495.148C48.7147 495.521 4Line truncated
|
||||
<path d="M36.428 513.796H32.936L32.336 515.5H30.908L33.896 507.148H35.48L38.468 515.5H37.028L36.428 513.796ZM36.044 512.68L34.688 508.804L33.32 512.68H36.044ZM39.0712 512.164C39.0712 511.5 39.2072 510.912 39.4792 510.4C39.7592 509.888 40.1352 509.492 40.6072 509.212C41.0872 508.924 41.6192 508.78 42.2032 508.78C42.6352 508.78 43.0592 508.876 43.4752 509.068C43.8992 509.252 44.2352 509.5 44.4832 509.812V506.62H45.8632V515.5H44.4832V514.504C44.2592 514.824 43.9472 515.088 43.5472 515.296C43.1552 Line truncated
|
||||
<path d="M257.216 540.004C258.032 540.004 258.756 540.188 259.388 540.556C260.028 540.916 260.524 541.424 260.876 542.08C261.236 542.728 261.416 543.468 261.416 544.3C261.416 545.132 261.236 545.876 260.876 546.532C260.524 547.18 260.028 547.688 259.388 548.056C258.756 548.416 258.032 548.596 257.216 548.596C256.392 548.596 255.66 548.416 255.02 548.056C254.388 547.688 253.892 547.18 253.532 546.532C253.18 545.876 253.004 545.132 253.004 544.3C253.004 543.468 253.18 542.728 253.532 542.08C253.8Line truncated
|
||||
<path d="M35.216 540.004C36.032 540.004 36.756 540.188 37.388 540.556C38.028 540.916 38.524 541.424 38.876 542.08C39.236 542.728 39.416 543.468 39.416 544.3C39.416 545.132 39.236 545.876 38.876 546.532C38.524 547.18 38.028 547.688 37.388 548.056C36.756 548.416 36.032 548.596 35.216 548.596C34.392 548.596 33.66 548.416 33.02 548.056C32.388 547.688 31.892 547.18 31.532 546.532C31.18 545.876 31.004 545.132 31.004 544.3C31.004 543.468 31.18 542.728 31.532 542.08C31.892 541.424 32.388 540.916 33.02 Line truncated
|
||||
<rect x="782" y="176.5" width="200" height="200" rx="14.2857" transform="rotate(90 782 176.5)" fill="white"/>
|
||||
<rect x="784.232" y="174.268" width="204.464" height="204.464" rx="16.5179" transform="rotate(90 784.232 174.268)" stroke="url(#paint2_linear_2006_114)" stroke-opacity="0.8" stroke-width="4.46429"/>
|
||||
<rect x="594" y="23" width="198" height="108" fill="url(#pattern1_2006_114)"/>
|
||||
</g>
|
||||
<defs>
|
||||
<filter id="filter0_f_2006_114" x="-486.5" y="192.5" width="998" height="998" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
||||
<feGaussianBlur stdDeviation="170" result="effect1_foregroundBlur_2006_114"/>
|
||||
</filter>
|
||||
<filter id="filter1_f_2006_114" x="225" y="88" width="1038" height="1038" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
||||
<feGaussianBlur stdDeviation="180" result="effect1_foregroundBlur_2006_114"/>
|
||||
</filter>
|
||||
<filter id="filter2_f_2006_114" x="-257.655" y="-360.655" width="676.31" height="676.31" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
||||
<feGaussianBlur stdDeviation="89.5775" result="effect1_foregroundBlur_2006_114"/>
|
||||
</filter>
|
||||
<pattern id="pattern0_2006_114" patternContentUnits="objectBoundingBox" width="1" height="1">
|
||||
<use xlink:href="#image0_2006_114" transform="matrix(0.000918274 0 0 0.00408892 0 -0.000892285)"/>
|
||||
</pattern>
|
||||
<pattern id="pattern1_2006_114" patternContentUnits="objectBoundingBox" width="1" height="1">
|
||||
<use xlink:href="#image1_2006_114" transform="matrix(0.0014782 0 0 0.00271003 -0.000369549 0)"/>
|
||||
</pattern>
|
||||
<linearGradient id="paint0_linear_2006_114" x1="276" y1="253" x2="314" y2="253" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="white"/>
|
||||
<stop offset="1" stop-color="#F9FDFF"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_2006_114" x1="36" y1="146" x2="264" y2="146" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#22A8F1"/>
|
||||
<stop offset="1" stop-color="#5CBFF5"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint2_linear_2006_114" x1="782" y1="276.5" x2="982" y2="276.5" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#E3F4FD"/>
|
||||
<stop offset="1" stop-color="#1FAAEC"/>
|
||||
</linearGradient>
|
||||
<clipPath id="clip0_2006_114">
|
||||
<rect width="595" height="842" fill="white" transform="translate(842 6.10352e-05) rotate(90)"/>
|
||||
</clipPath>
|
||||
<image id="image0_2006_114" width="1089" height="245" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABEEAAAD1CAYAAAC/deukAAAACXBIWXMAAAsSAAALEgHS3X78AAAgAElEQVR4nOzdd5OcR3og+OdJ97ry1d4A3fAAAZAcuqEZauVGM9LMGp12T6tYxe5F3AfRp9g/Li4uNkK7e4o7SaHQaGOlGY04ImeGbmhBwhLobqDRvrrs6zPz2T+a5IAYWFpQyl9ERVV115uZr6nqzqeezEQiYgBA8Ol82u2c+4f3+HN7w8/ww+efth66Rfk3P/+iroGP6r7T/b243XH7vHzUjru16ca232sZd9vfW/3+bsfsTvefxr2ej3up58bff9a23et5+Sw+7TF0n5uO4ziO4zjOP3f3+j/03f7fvrn/dKf6AAA4Line truncated
|
||||
<image id="image1_2006_114" width="677" height="369" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAqUAAAFxCAYAAABKn9GWAAAQAElEQVR4Aex9BYBUR7r1qWvtNu7GDDO4u0OAOHF32WTjJMTd3d0VgoXg7u4wwgDj7m7tff+veiDJZrP2v7f7suFe5uu6t7xOVU+dOl9PI0C7NAQ0BDQENAQ0BDQENAQ0BDQE/o8R0Ejp//EEaM1rCGgInAoIaGPUENAQ0BDQEPhHCGik9B8hpKVrCGgIaAhoCGgIaAhoCGgI/NsR+B+T0n97D7UGNAQ0BDQENAQ0BDQENAQ0BP7wCGik9A8/xdoANQQ0BP4ACGhD0BDQENAQ+MMjoJHSP/wUawPUENAQ0BDQENAQ0BDQEPj9I/B/T0p//xhpPdQQ0BDQENAQ0Line truncated
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 818 KiB |
@@ -42,10 +42,8 @@ const CertificatePage: FC = (): ReactElement => {
|
||||
}, [certId]);
|
||||
|
||||
// Fetch certificate data using the new endpoint
|
||||
const { data: certificateData, isLoading: isLoadingCertificate } = useCertificatePublicData(
|
||||
decodedInfo?.userId || '',
|
||||
!!decodedInfo?.userId
|
||||
);
|
||||
const { data: certificateData, isLoading: isLoadingCertificate } =
|
||||
useCertificatePublicData(decodedInfo?.userId || '', !!decodedInfo?.userId);
|
||||
|
||||
// Generate QR Code
|
||||
useEffect(() => {
|
||||
@@ -292,9 +290,7 @@ const CertificatePage: FC = (): ReactElement => {
|
||||
{team && isTeamMember && (
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() =>
|
||||
navigate(`/teams/${team.id}/submission`)
|
||||
}
|
||||
onClick={() => navigate(`/teams/${team.id}/submission`)}
|
||||
>
|
||||
Back to Submission
|
||||
</Button>
|
||||
@@ -425,7 +421,7 @@ const CertificatePage: FC = (): ReactElement => {
|
||||
|
||||
{/* Actions */}
|
||||
{isTeamMember && (
|
||||
<div className="bg-gray-50 dark:bg-gray-800 p-6 grid grid-cols-2 xl:grid-cols-3 gap-3 justify-center no-print">
|
||||
<div className="bg-gray-50 dark:bg-gray-900 p-6 grid grid-cols-2 xl:grid-cols-3 gap-3 justify-center no-print">
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={handleDownloadCertificate}
|
||||
@@ -444,9 +440,7 @@ const CertificatePage: FC = (): ReactElement => {
|
||||
</Button>
|
||||
{team && (
|
||||
<Button
|
||||
onClick={() =>
|
||||
navigate(`/teams/${team.id}/submission`)
|
||||
}
|
||||
onClick={() => navigate(`/teams/${team.id}/submission`)}
|
||||
variant="secondary"
|
||||
className="col-span-2 flex items-center gap-2 xl:col-span-1"
|
||||
>
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
{
|
||||
"message": "Success",
|
||||
"data": [
|
||||
{
|
||||
"id": "afbead4b-2ffa-435e-ae7b-91f26e111fc6",
|
||||
"team_id": "ab436f6e-027f-4831-873b-474345273491",
|
||||
"team": {
|
||||
"id": "ab436f6e-027f-4831-873b-474345273491",
|
||||
"name": "nama timnya apa ya @All",
|
||||
"description": "pikri carry",
|
||||
"city": "Kota Depok",
|
||||
"visibility": "public",
|
||||
"logo": null,
|
||||
"banner": "https://voymsjeqmvwrryetfldy.supabase.co/storage/v1/object/public/hackathon-uploads/teams/9a6dc902-c91b-4276-89cf-31e821531158-1764517227821.png",
|
||||
"leader_id": "9a6dc902-c91b-4276-89cf-31e821531158",
|
||||
"created_at": "2025-11-30T15:40:29.865564Z",
|
||||
"updated_at": "2025-11-30T15:48:52.520850Z"
|
||||
},
|
||||
"rank": 1,
|
||||
"prize": "Rp6.000.000",
|
||||
"announced_at": "2025-12-15T16:41:01.931757Z",
|
||||
"created_at": "2025-12-15T16:41:01.931757Z",
|
||||
"updated_at": "2025-12-15T16:41:01.931757Z"
|
||||
},
|
||||
{
|
||||
"id": "8e591dc6-3cff-4019-bdfc-5e42ea081208",
|
||||
"team_id": "06cbf0f4-cdad-40d0-b0d0-1fa8a3d50968",
|
||||
"team": {
|
||||
"id": "06cbf0f4-cdad-40d0-b0d0-1fa8a3d50968",
|
||||
"name": "TheLastOfUs",
|
||||
"description": "We truly believe in Meaning First — designing innovation, powered by technology.",
|
||||
"city": "Bandung",
|
||||
"visibility": "private",
|
||||
"logo": "https://voymsjeqmvwrryetfldy.supabase.co/storage/v1/object/public/hackathon-uploads/teams/a32c0e81-1fbd-4bec-8e91-4cd6d10f553b-1764074851150.png",
|
||||
"banner": "https://voymsjeqmvwrryetfldy.supabase.co/storage/v1/object/public/hackathon-uploads/teams/a32c0e81-1fbd-4bec-8e91-4cd6d10f553b-1764074852181.png",
|
||||
"leader_id": "a32c0e81-1fbd-4bec-8e91-4cd6d10f553b",
|
||||
"created_at": "2025-11-25T12:47:33.040330Z",
|
||||
"updated_at": "2025-11-25T12:47:33.040330Z"
|
||||
},
|
||||
"rank": 2,
|
||||
"prize": "Rp4.000.000",
|
||||
"announced_at": "2025-12-15T16:41:32.534295Z",
|
||||
"created_at": "2025-12-15T16:41:32.534295Z",
|
||||
"updated_at": "2025-12-15T16:41:32.534295Z"
|
||||
},
|
||||
{
|
||||
"id": "5ca29971-5726-40dd-872c-853a6bfa03d9",
|
||||
"team_id": "9d9ed9db-3523-47ae-a387-66c36dbec983",
|
||||
"team": {
|
||||
"id": "9d9ed9db-3523-47ae-a387-66c36dbec983",
|
||||
"name": "Pecinta Capybara",
|
||||
"description": "Ingin ikut meramaikan suasana.",
|
||||
"city": "Tangerang",
|
||||
"visibility": "public",
|
||||
"logo": "https://voymsjeqmvwrryetfldy.supabase.co/storage/v1/object/public/hackathon-uploads/teams/648f6d3d-a92e-49cc-805e-2f600de87074-1764205746897.jpg",
|
||||
"banner": "https://voymsjeqmvwrryetfldy.supabase.co/storage/v1/object/public/hackathon-uploads/teams/648f6d3d-a92e-49cc-805e-2f600de87074-1764205747479.png",
|
||||
"leader_id": "648f6d3d-a92e-49cc-805e-2f600de87074",
|
||||
"created_at": "2025-11-27T01:09:32.787150Z",
|
||||
"updated_at": "2025-11-29T15:30:43.334609Z"
|
||||
},
|
||||
"rank": 3,
|
||||
"prize": "Rp2.500.000",
|
||||
"announced_at": "2025-12-15T16:41:59.091294Z",
|
||||
"created_at": "2025-12-15T16:41:59.091294Z",
|
||||
"updated_at": "2025-12-15T16:41:59.091294Z"
|
||||
},
|
||||
{
|
||||
"id": "e9f82de6-f5d0-43c1-a0bd-4687f2e4ed5e",
|
||||
"team_id": "95f782f4-433f-489d-a06d-eed89ca83beb",
|
||||
"team": {
|
||||
"id": "95f782f4-433f-489d-a06d-eed89ca83beb",
|
||||
"name": "Savora",
|
||||
"description": "a complete food ordering application for Indonesian SMEs (UMKM)",
|
||||
"city": "Bandung",
|
||||
"visibility": "private",
|
||||
"logo": "https://voymsjeqmvwrryetfldy.supabase.co/storage/v1/object/public/hackathon-uploads/teams/748de15d-374a-4756-89e2-75754e90542f-1764071952995.png",
|
||||
"banner": "https://voymsjeqmvwrryetfldy.supabase.co/storage/v1/object/public/hackathon-uploads/teams/748de15d-374a-4756-89e2-75754e90542f-1764071953753.png",
|
||||
"leader_id": "748de15d-374a-4756-89e2-75754e90542f",
|
||||
"created_at": "2025-11-25T11:57:52.098043Z",
|
||||
"updated_at": "2025-11-25T11:59:14.508877Z"
|
||||
},
|
||||
"rank": 4,
|
||||
"prize": "Rp500.000",
|
||||
"announced_at": "2025-12-15T16:42:39.361469Z",
|
||||
"created_at": "2025-12-15T16:42:39.361469Z",
|
||||
"updated_at": "2025-12-15T16:42:39.361469Z"
|
||||
},
|
||||
{
|
||||
"id": "ed93e080-0913-4c70-b69d-fce9bc0cdda7",
|
||||
"team_id": "f9747574-8c01-4c3e-b20a-7ac1a70b947a",
|
||||
"team": {
|
||||
"id": "f9747574-8c01-4c3e-b20a-7ac1a70b947a",
|
||||
"name": "AMBANET Corporation 🙀😸🤓",
|
||||
"description": "Bersiaplah ambanet bakal mengguncang seluruh team hackathon ygy",
|
||||
"city": "Kota Padang",
|
||||
"visibility": "public",
|
||||
"logo": "https://voymsjeqmvwrryetfldy.supabase.co/storage/v1/object/public/hackathon-uploads/teams/a5ea628a-24d9-4754-b461-3eda53da53bf-1764351234491.png",
|
||||
"banner": "https://voymsjeqmvwrryetfldy.supabase.co/storage/v1/object/public/hackathon-uploads/teams/a5ea628a-24d9-4754-b461-3eda53da53bf-1764219109981.gif",
|
||||
"leader_id": "a5ea628a-24d9-4754-b461-3eda53da53bf",
|
||||
"created_at": "2025-11-27T04:48:53.080955Z",
|
||||
"updated_at": "2025-11-29T13:31:51.276246Z"
|
||||
},
|
||||
"rank": 5,
|
||||
"prize": "Rp500.000",
|
||||
"announced_at": "2025-12-15T16:42:57.065225Z",
|
||||
"created_at": "2025-12-15T16:42:57.065225Z",
|
||||
"updated_at": "2025-12-15T16:42:57.065225Z"
|
||||
},
|
||||
{
|
||||
"id": "7ed55b12-d585-419d-bae2-1a362a57798e",
|
||||
"team_id": "4f3e2e85-3f3f-4880-9104-b3f66bb1c9d9",
|
||||
"team": {
|
||||
"id": "4f3e2e85-3f3f-4880-9104-b3f66bb1c9d9",
|
||||
"name": "Pemuja Deadline Anti Refund",
|
||||
"description": "Diusahakan banyak deadline tapi kg refund ~ \"Angga Kentod\"",
|
||||
"city": "Kota Bandung",
|
||||
"visibility": "public",
|
||||
"logo": "https://voymsjeqmvwrryetfldy.supabase.co/storage/v1/object/public/hackathon-uploads/teams/6cf045e2-d853-4480-91b8-244fb0b76b7f-1764332887921.jpg",
|
||||
"banner": null,
|
||||
"leader_id": "6cf045e2-d853-4480-91b8-244fb0b76b7f",
|
||||
"created_at": "2025-11-27T05:02:35.128625Z",
|
||||
"updated_at": "2025-11-28T12:28:09.697222Z"
|
||||
},
|
||||
"rank": 6,
|
||||
"prize": "Rp200.000",
|
||||
"announced_at": "2025-12-15T16:43:09.471633Z",
|
||||
"created_at": "2025-12-15T16:43:09.471633Z",
|
||||
"updated_at": "2025-12-15T16:43:09.471633Z"
|
||||
},
|
||||
{
|
||||
"id": "0b3a0b5c-2038-4d09-85a7-ae4709702951",
|
||||
"team_id": "9d8cd404-8e69-4efd-a125-fc0863d7afc7",
|
||||
"team": {
|
||||
"id": "9d8cd404-8e69-4efd-a125-fc0863d7afc7",
|
||||
"name": "Aku nak meletup",
|
||||
"description": "masih pemula bg",
|
||||
"city": "Boyolali",
|
||||
"visibility": "public",
|
||||
"logo": "https://voymsjeqmvwrryetfldy.supabase.co/storage/v1/object/public/hackathon-uploads/teams/c79d4b2b-e63f-4187-a8cd-520fde333ab3-1764211224866.jpg",
|
||||
"banner": null,
|
||||
"leader_id": "c79d4b2b-e63f-4187-a8cd-520fde333ab3",
|
||||
"created_at": "2025-11-27T02:40:25.376372Z",
|
||||
"updated_at": "2025-11-27T02:40:25.376372Z"
|
||||
},
|
||||
"rank": 7,
|
||||
"prize": "Rp200.000",
|
||||
"announced_at": "2025-12-15T16:43:22.467439Z",
|
||||
"created_at": "2025-12-15T16:43:22.467439Z",
|
||||
"updated_at": "2025-12-15T16:43:22.467439Z"
|
||||
},
|
||||
{
|
||||
"id": "bb0706b9-b723-4a49-b0b0-3be9af70225b",
|
||||
"team_id": "dd6c62dd-2632-4156-9da5-8ff9a3560f06",
|
||||
"team": {
|
||||
"id": "dd6c62dd-2632-4156-9da5-8ff9a3560f06",
|
||||
"name": "Iseng Hackathon",
|
||||
"description": "HME ITB Oke Champ",
|
||||
"city": "Kota Bandung",
|
||||
"visibility": "public",
|
||||
"logo": null,
|
||||
"banner": null,
|
||||
"leader_id": "d1e4e3bf-098f-453e-bf00-612685d311d9",
|
||||
"created_at": "2025-11-30T03:58:52.429673Z",
|
||||
"updated_at": "2025-11-30T03:58:52.429673Z"
|
||||
},
|
||||
"rank": 8,
|
||||
"prize": "Rp200.000",
|
||||
"announced_at": "2025-12-15T16:43:34.191207Z",
|
||||
"created_at": "2025-12-15T16:43:34.191207Z",
|
||||
"updated_at": "2025-12-15T16:43:34.191207Z"
|
||||
},
|
||||
{
|
||||
"id": "4a3e807c-2cf2-4557-a6af-99fcc726cebb",
|
||||
"team_id": "52316c25-5697-4436-bfc2-02baef8ca956",
|
||||
"team": {
|
||||
"id": "52316c25-5697-4436-bfc2-02baef8ca956",
|
||||
"name": "Gorengan 3 Ronde",
|
||||
"description": "Jam 10 izin turun",
|
||||
"city": "Kota Medan",
|
||||
"visibility": "public",
|
||||
"logo": "https://voymsjeqmvwrryetfldy.supabase.co/storage/v1/object/public/hackathon-uploads/teams/e7bec056-7f63-4642-a763-afa39c3c340e-1764509780084.png",
|
||||
"banner": "https://voymsjeqmvwrryetfldy.supabase.co/storage/v1/object/public/hackathon-uploads/teams/e7bec056-7f63-4642-a763-afa39c3c340e-1764509810717.png",
|
||||
"leader_id": "e7bec056-7f63-4642-a763-afa39c3c340e",
|
||||
"created_at": "2025-11-30T13:36:52.344019Z",
|
||||
"updated_at": "2025-11-30T13:36:52.344019Z"
|
||||
},
|
||||
"rank": 9,
|
||||
"prize": "Rp200.000",
|
||||
"announced_at": "2025-12-15T16:43:51.988908Z",
|
||||
"created_at": "2025-12-15T16:43:51.988908Z",
|
||||
"updated_at": "2025-12-15T16:43:51.988908Z"
|
||||
},
|
||||
{
|
||||
"id": "e18827dd-839d-4e54-9126-c1faebce2c2c",
|
||||
"team_id": "d2b2fb99-e934-405c-836e-711352e0f8a0",
|
||||
"team": {
|
||||
"id": "d2b2fb99-e934-405c-836e-711352e0f8a0",
|
||||
"name": "Spark Developer",
|
||||
"description": "Yang penting yakin untuk menang.",
|
||||
"city": "Kota Batam",
|
||||
"visibility": "public",
|
||||
"logo": "https://voymsjeqmvwrryetfldy.supabase.co/storage/v1/object/public/hackathon-uploads/teams/087921fb-2d17-423b-9628-73de2176360f-1764486044138.png",
|
||||
"banner": "https://voymsjeqmvwrryetfldy.supabase.co/storage/v1/object/public/hackathon-uploads/teams/087921fb-2d17-423b-9628-73de2176360f-1764486059581.jpg",
|
||||
"leader_id": "087921fb-2d17-423b-9628-73de2176360f",
|
||||
"created_at": "2025-11-29T04:49:54.266394Z",
|
||||
"updated_at": "2025-11-30T07:01:02.316185Z"
|
||||
},
|
||||
"rank": 10,
|
||||
"prize": "Rp200.000",
|
||||
"announced_at": "2025-12-15T16:44:02.680036Z",
|
||||
"created_at": "2025-12-15T16:44:02.680036Z",
|
||||
"updated_at": "2025-12-15T16:44:02.680036Z"
|
||||
},
|
||||
{
|
||||
"id": "a0ed8e58-f8e3-491c-8c03-20e82090d6f8",
|
||||
"team_id": "d30d7d03-dce7-4220-9e7f-a537a45c54e0",
|
||||
"team": {
|
||||
"id": "d30d7d03-dce7-4220-9e7f-a537a45c54e0",
|
||||
"name": "Eye of Horus",
|
||||
"description": "Eye of horus",
|
||||
"city": "Garut",
|
||||
"visibility": "public",
|
||||
"logo": "https://voymsjeqmvwrryetfldy.supabase.co/storage/v1/object/public/hackathon-uploads/teams/96dc1c2b-a1ef-441a-93d5-da2ccad37d81-1764145807852.png",
|
||||
"banner": "https://voymsjeqmvwrryetfldy.supabase.co/storage/v1/object/public/hackathon-uploads/teams/96dc1c2b-a1ef-441a-93d5-da2ccad37d81-1764145810329.jpeg",
|
||||
"leader_id": "96dc1c2b-a1ef-441a-93d5-da2ccad37d81",
|
||||
"created_at": "2025-11-26T08:30:10.385714Z",
|
||||
"updated_at": "2025-11-26T09:35:12.386986Z"
|
||||
},
|
||||
"rank": 11,
|
||||
"prize": "hadiah",
|
||||
"announced_at": "2025-12-16T04:19:09.502015Z",
|
||||
"created_at": "2025-12-16T04:19:09.502015Z",
|
||||
"updated_at": "2025-12-16T04:19:09.502015Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,569 @@
|
||||
import { FC, ReactElement, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useNavigate, useParams } from 'react-router';
|
||||
import { Button } from '@imphnen-frontend-service/ui/atoms';
|
||||
import { Icon } from '@iconify/react';
|
||||
import { decodeWinnerCertificateId } from '../../../../utils/certificate';
|
||||
import {
|
||||
useAuthStore,
|
||||
useMyTeams,
|
||||
useTeamById,
|
||||
useWinners,
|
||||
} from '@imphnen-frontend-service/service';
|
||||
import QRCode from 'qrcode';
|
||||
import html2canvas from 'html2canvas';
|
||||
|
||||
type WinnerEntry = {
|
||||
team_id: string;
|
||||
rank: number;
|
||||
team?: {
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
};
|
||||
|
||||
const formatOrdinalRank = (rank: number): string => {
|
||||
const mod100 = rank % 100;
|
||||
if (mod100 >= 11 && mod100 <= 13) return `${rank}th`;
|
||||
|
||||
switch (rank % 10) {
|
||||
case 1:
|
||||
return `${rank}st`;
|
||||
case 2:
|
||||
return `${rank}nd`;
|
||||
case 3:
|
||||
return `${rank}rd`;
|
||||
default:
|
||||
return `${rank}th`;
|
||||
}
|
||||
};
|
||||
|
||||
const CERT_WIDTH = 1000;
|
||||
const CERT_HEIGHT = (CERT_WIDTH * 595) / 842; // matches blank_winner_cert.svg aspect ratio
|
||||
|
||||
const CertificateWinnerPage: FC = (): ReactElement => {
|
||||
const { certId } = useParams<{ certId: string }>();
|
||||
const navigate = useNavigate();
|
||||
const { session } = useAuthStore();
|
||||
const { data: myTeamsData } = useMyTeams();
|
||||
const {
|
||||
data: winnersResponse,
|
||||
isLoading: isLoadingWinners,
|
||||
isError: isWinnersError,
|
||||
} = useWinners();
|
||||
|
||||
const [decodedTeamId, setDecodedTeamId] = useState<string>('');
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const [qrCodeUrl, setQrCodeUrl] = useState<string>('');
|
||||
const certificateRef = useRef<HTMLDivElement>(null);
|
||||
const [isGenerating, setIsGenerating] = useState(false);
|
||||
const [certificateImage, setCertificateImage] = useState<string>('');
|
||||
const [showTemplate, setShowTemplate] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
if (!certId) return;
|
||||
|
||||
decodeWinnerCertificateId(certId)
|
||||
.then((decoded) => setDecodedTeamId(decoded.teamId))
|
||||
.catch(() => setError('Invalid certificate ID'));
|
||||
}, [certId]);
|
||||
|
||||
const winners = useMemo(
|
||||
() => (winnersResponse?.data || []) as WinnerEntry[],
|
||||
[winnersResponse?.data]
|
||||
);
|
||||
const winnerEntry = useMemo(() => {
|
||||
if (!decodedTeamId) return undefined;
|
||||
return winners.find((w) => w.team_id === decodedTeamId);
|
||||
}, [decodedTeamId, winners]);
|
||||
|
||||
const rankLabel = useMemo(() => {
|
||||
if (!winnerEntry?.rank) return '';
|
||||
return formatOrdinalRank(winnerEntry.rank);
|
||||
}, [winnerEntry?.rank]);
|
||||
|
||||
const { data: teamData, isLoading: isLoadingTeam } = useTeamById(
|
||||
decodedTeamId,
|
||||
!!decodedTeamId
|
||||
);
|
||||
|
||||
const team = teamData?.data;
|
||||
|
||||
const memberNames = useMemo(() => {
|
||||
const members = team?.members || [];
|
||||
return members
|
||||
.map((m) => m.user?.fullname)
|
||||
.filter((name): name is string => !!name);
|
||||
}, [team?.members]);
|
||||
|
||||
const isWinnerTeam = !!winnerEntry;
|
||||
const isTeamMember =
|
||||
!!session?.user?.id &&
|
||||
!!decodedTeamId &&
|
||||
(myTeamsData?.data || []).some(
|
||||
(t) => (t as { id?: string } | null | undefined)?.id === decodedTeamId
|
||||
);
|
||||
|
||||
// Generate QR Code (public link)
|
||||
useEffect(() => {
|
||||
if (!certId) return;
|
||||
|
||||
const encodedCertId = encodeURIComponent(certId);
|
||||
const certificateUrl = `${window.location.origin}/certificate/winner/${encodedCertId}`;
|
||||
|
||||
QRCode.toDataURL(certificateUrl, {
|
||||
width: 200,
|
||||
margin: 1,
|
||||
color: {
|
||||
dark: '#000000',
|
||||
light: '#ffffff',
|
||||
},
|
||||
})
|
||||
.then(setQrCodeUrl)
|
||||
.catch((err) => console.error('QR Code generation failed:', err));
|
||||
}, [certId]);
|
||||
|
||||
// Generate certificate canvas screenshot
|
||||
useEffect(() => {
|
||||
const generateCertificate = async () => {
|
||||
if (!certificateRef.current) return;
|
||||
if (!team?.name) return;
|
||||
if (!qrCodeUrl) return;
|
||||
if (!winnerEntry?.rank) return;
|
||||
|
||||
setIsGenerating(true);
|
||||
try {
|
||||
await new Promise((resolve) => setTimeout(resolve, 1500));
|
||||
|
||||
const canvas = await html2canvas(certificateRef.current, {
|
||||
scale: 4,
|
||||
useCORS: true,
|
||||
backgroundColor: '#ffffff',
|
||||
logging: false,
|
||||
width: CERT_WIDTH,
|
||||
height: CERT_HEIGHT,
|
||||
allowTaint: true,
|
||||
imageTimeout: 0,
|
||||
removeContainer: true,
|
||||
});
|
||||
|
||||
const imageUrl = canvas.toDataURL('image/png', 1.0);
|
||||
setCertificateImage(imageUrl);
|
||||
setShowTemplate(false);
|
||||
} catch (e) {
|
||||
console.error('Failed to generate certificate:', e);
|
||||
} finally {
|
||||
setIsGenerating(false);
|
||||
}
|
||||
};
|
||||
|
||||
generateCertificate();
|
||||
}, [team?.name, memberNames, qrCodeUrl, winnerEntry?.rank]);
|
||||
|
||||
const handleDownloadCertificate = () => {
|
||||
if (!certificateImage) return;
|
||||
|
||||
const link = document.createElement('a');
|
||||
link.href = certificateImage;
|
||||
link.download = `winner-certificate-${team?.name || 'hackathon'}.png`;
|
||||
link.click();
|
||||
};
|
||||
|
||||
const handlePrintCertificate = () => {
|
||||
if (!certificateImage) return;
|
||||
|
||||
const printWindow = window.open('', '_blank');
|
||||
if (!printWindow) return;
|
||||
|
||||
printWindow.document.write(`
|
||||
<html>
|
||||
<head>
|
||||
<title>Certificate - ${team?.name}</title>
|
||||
<style>
|
||||
body { margin: 0; display: flex; justify-content: center; align-items: center; min-height: 100vh; }
|
||||
img { max-width: 100%; height: auto; }
|
||||
@media print {
|
||||
@page { size: A4 landscape; margin: 0; }
|
||||
body { margin: 0; }
|
||||
img { width: 100%; height: auto; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<img src="${certificateImage}" />
|
||||
</body>
|
||||
</html>
|
||||
`);
|
||||
printWindow.document.close();
|
||||
printWindow.onload = () => {
|
||||
printWindow.print();
|
||||
};
|
||||
};
|
||||
|
||||
if (error || !certId) {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center min-h-screen bg-gray-50 dark:bg-gray-950">
|
||||
<h2 className="text-2xl font-bold text-gray-900 dark:text-white mb-4">
|
||||
Invalid Certificate
|
||||
</h2>
|
||||
<p className="text-gray-600 dark:text-gray-400 mb-6">
|
||||
{error || 'The certificate ID is invalid or malformed.'}
|
||||
</p>
|
||||
<Button onClick={() => navigate('/')}>Back to Home</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!decodedTeamId || isLoadingTeam) {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen bg-gray-50 dark:bg-gray-950">
|
||||
<div className="text-center">
|
||||
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"></div>
|
||||
<div className="text-gray-600 dark:text-gray-400">
|
||||
Loading certificate...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (isLoadingWinners) {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen bg-gray-50 dark:bg-gray-950">
|
||||
<div className="text-center">
|
||||
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"></div>
|
||||
<div className="text-gray-600 dark:text-gray-400">
|
||||
Loading winners...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (isWinnersError) {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center min-h-screen bg-gray-50 dark:bg-gray-950">
|
||||
<h2 className="text-2xl font-bold text-gray-900 dark:text-white mb-4">
|
||||
Unable to Load Winners
|
||||
</h2>
|
||||
<p className="text-gray-600 dark:text-gray-400 mb-6">
|
||||
Please try again later.
|
||||
</p>
|
||||
<Button onClick={() => navigate('/')}>Back to Home</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!isWinnerTeam) {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center min-h-screen bg-gray-50 dark:bg-gray-950">
|
||||
<h2 className="text-2xl font-bold text-gray-900 dark:text-white mb-4">
|
||||
Certificate Not Found
|
||||
</h2>
|
||||
<p className="text-gray-600 dark:text-gray-400 mb-6">
|
||||
This team is not listed as a hackathon winner.
|
||||
</p>
|
||||
<Button onClick={() => navigate('/')}>Back to Home</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!team?.name) {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center min-h-screen bg-gray-50 dark:bg-gray-950">
|
||||
<h2 className="text-2xl font-bold text-gray-900 dark:text-white mb-4">
|
||||
Team Not Found
|
||||
</h2>
|
||||
<p className="text-gray-600 dark:text-gray-400 mb-6">
|
||||
The team associated with this certificate could not be loaded.
|
||||
</p>
|
||||
<Button onClick={() => navigate('/')}>Back to Home</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50 dark:bg-gray-950">
|
||||
{/* Header */}
|
||||
<div className="bg-white dark:bg-gray-900 border-b dark:border-gray-700 no-print">
|
||||
<div className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 className="text-3xl font-bold text-gray-900 dark:text-white">
|
||||
Winner Certificate
|
||||
</h1>
|
||||
<p className="text-gray-600 dark:text-gray-400 mt-1">
|
||||
{team.name}
|
||||
</p>
|
||||
</div>
|
||||
{isTeamMember && (
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => navigate('/dashboard')}
|
||||
>
|
||||
Back to Dashboard
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-12"
|
||||
id="certificate-wrapper"
|
||||
>
|
||||
{/* Hidden Template for Canvas Generation */}
|
||||
<div
|
||||
className={showTemplate ? 'block' : 'hidden'}
|
||||
style={{ position: 'absolute', left: '-9999px' }}
|
||||
>
|
||||
<div
|
||||
ref={certificateRef}
|
||||
id="certificate-template"
|
||||
style={{
|
||||
position: 'relative',
|
||||
backgroundImage: 'url(/images/blank_winner_cert.svg)',
|
||||
backgroundSize: 'cover',
|
||||
backgroundPosition: 'center',
|
||||
width: `${CERT_WIDTH}px`,
|
||||
height: `${CERT_HEIGHT}px`,
|
||||
}}
|
||||
>
|
||||
<style>{`
|
||||
#winner-members li::marker {
|
||||
color: #59bef5;
|
||||
}
|
||||
`}</style>
|
||||
|
||||
{/* Team Name */}
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
top: '37%',
|
||||
left: '3.5%',
|
||||
width: '55%',
|
||||
}}
|
||||
>
|
||||
<h3
|
||||
style={{
|
||||
fontFamily: 'Poppins, sans-serif',
|
||||
fontWeight: 'bold',
|
||||
color: '#59bef5',
|
||||
textAlign: 'left',
|
||||
fontSize: '28px',
|
||||
lineHeight: '1.2',
|
||||
wordBreak: 'break-word',
|
||||
margin: 0,
|
||||
}}
|
||||
>
|
||||
{team.name}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
{/* Members list */}
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
top: '42.5%',
|
||||
left: '3.5%',
|
||||
width: '55%',
|
||||
}}
|
||||
>
|
||||
<ul
|
||||
id="winner-members"
|
||||
style={{
|
||||
margin: 0,
|
||||
fontFamily: 'Poppins, sans-serif',
|
||||
fontSize: '18px',
|
||||
lineHeight: '1.35',
|
||||
color: '#59bef5',
|
||||
}}
|
||||
>
|
||||
{(memberNames.length
|
||||
? memberNames
|
||||
: ['(Members unavailable)']
|
||||
).map((name) => (
|
||||
<li key={name}>• {name}</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{/* Award text */}
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
top: '62%',
|
||||
left: '3.5%',
|
||||
width: '60%',
|
||||
}}
|
||||
>
|
||||
<p
|
||||
style={{
|
||||
margin: 0,
|
||||
fontFamily: 'Poppins, sans-serif',
|
||||
fontSize: '18px',
|
||||
lineHeight: '1.35',
|
||||
color: '#6B6B6B',
|
||||
}}
|
||||
>
|
||||
Diberikan sebagai penghargaan atas pencapaian meraih
|
||||
<br />
|
||||
<b>JUARA {winnerEntry.rank}</b> pada Hackathon IMPHNEN x
|
||||
Kolosal.ai
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Rank badge */}
|
||||
{!!rankLabel && (
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
top: '8%',
|
||||
right: '8.5%',
|
||||
width: '190px',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
padding: '6px 16px',
|
||||
textAlign: 'center',
|
||||
fontFamily: 'Poppins, sans-serif',
|
||||
fontWeight: 700,
|
||||
color: '#78350F',
|
||||
fontSize: '24px',
|
||||
lineHeight: '1',
|
||||
}}
|
||||
>
|
||||
{rankLabel}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* QR Code (same placement as existing certificate page) */}
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
top: '33%',
|
||||
right: '9.3%',
|
||||
width: '190px',
|
||||
height: '190px',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
}}
|
||||
>
|
||||
{qrCodeUrl && (
|
||||
<img
|
||||
src={qrCodeUrl}
|
||||
alt="Certificate QR Code"
|
||||
style={{ width: '190px', height: '190px', display: 'block' }}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Display Certificate Image */}
|
||||
<div className="bg-white dark:bg-gray-900 rounded-lg shadow-xl dark:shadow-gray-950/50 overflow-hidden p-2">
|
||||
{isGenerating && (
|
||||
<div className="flex items-center justify-center p-12">
|
||||
<div className="text-center">
|
||||
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"></div>
|
||||
<div className="text-gray-600 dark:text-gray-400">
|
||||
Generating certificate...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{certificateImage && !isGenerating && (
|
||||
<img
|
||||
src={certificateImage}
|
||||
alt="Winner Certificate"
|
||||
className="w-full h-auto"
|
||||
style={{ maxWidth: '100%', height: 'auto' }}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Actions */}
|
||||
{isTeamMember && (
|
||||
<div className="bg-gray-50 dark:bg-gray-900 p-6 grid grid-cols-2 xl:grid-cols-3 gap-3 justify-center no-print">
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={handleDownloadCertificate}
|
||||
className="flex items-center gap-2"
|
||||
disabled={isGenerating}
|
||||
>
|
||||
{isGenerating ? (
|
||||
<>
|
||||
<Icon
|
||||
icon="svg-spinners:ring-resize"
|
||||
width="18"
|
||||
height="18"
|
||||
/>
|
||||
Generating...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Icon
|
||||
icon="heroicons:arrow-down-tray"
|
||||
width="18"
|
||||
height="18"
|
||||
/>
|
||||
Download
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={handlePrintCertificate}
|
||||
className="flex items-center gap-2"
|
||||
disabled={isGenerating}
|
||||
>
|
||||
{isGenerating ? (
|
||||
<>
|
||||
<Icon
|
||||
icon="svg-spinners:ring-resize"
|
||||
width="18"
|
||||
height="18"
|
||||
/>
|
||||
Generating...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Icon icon="mdi:printer" width="18" height="18" />
|
||||
Print
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => navigate('/dashboard')}
|
||||
variant="secondary"
|
||||
className="col-span-2 flex items-center gap-2 xl:col-span-1"
|
||||
>
|
||||
Back to Dashboard
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Info Box */}
|
||||
<div className="mt-8 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-6 no-print">
|
||||
<h3 className="font-bold text-blue-900 dark:text-blue-100 mb-2">
|
||||
Certificate Information
|
||||
</h3>
|
||||
<p className="text-sm text-blue-800 dark:text-blue-200">
|
||||
This certificate is a digital record of your hackathon achievement.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CertificateWinnerPage;
|
||||
@@ -1,15 +1,17 @@
|
||||
import { FC, ReactElement, useEffect, useState } from 'react';
|
||||
import { Link } from 'react-router';
|
||||
import { FC, ReactElement, useEffect, useMemo, useState } from 'react';
|
||||
import { Link, useNavigate } from 'react-router';
|
||||
import {
|
||||
useMyTeams,
|
||||
useMyInvitations,
|
||||
useRespondToInvitation,
|
||||
useAuthStore,
|
||||
useWinners,
|
||||
} from '@imphnen-frontend-service/service';
|
||||
import { toast } from 'sonner';
|
||||
import { Button } from '@imphnen-frontend-service/ui/atoms';
|
||||
import { Icon } from '@iconify/react';
|
||||
import ProfilePage from '../profile/page';
|
||||
import { encodeWinnerCertificateId } from '../../utils/certificate';
|
||||
|
||||
// Team features deadline: 2025-11-30 23:59:00 WIB (UTC+7)
|
||||
const TEAM_FEATURES_DEADLINE = new Date('2025-11-30T16:59:00Z');
|
||||
@@ -39,6 +41,7 @@ type Invitation = {
|
||||
|
||||
const DashboardPage: FC = (): ReactElement => {
|
||||
const { session } = useAuthStore();
|
||||
const navigate = useNavigate();
|
||||
const [showProfileModal, setShowProfileModal] = useState(false);
|
||||
const [timeLeft, setTimeLeft] = useState<{
|
||||
days: number;
|
||||
@@ -91,6 +94,7 @@ const DashboardPage: FC = (): ReactElement => {
|
||||
}
|
||||
}, [showProfileModal]);
|
||||
const { data: teamsData } = useMyTeams();
|
||||
const { data: winnersResponse } = useWinners();
|
||||
const { data: invitationsData } = useMyInvitations();
|
||||
const { mutateAsync: respondToInvitation } = useRespondToInvitation();
|
||||
|
||||
@@ -99,6 +103,13 @@ const DashboardPage: FC = (): ReactElement => {
|
||||
const invitations: Invitation[] = (invitationsData?.data ||
|
||||
[]) as Invitation[];
|
||||
|
||||
const winnerEntry = useMemo(() => {
|
||||
const team = (myTeams[0] as { id?: string } | null | undefined) || null;
|
||||
const winners = winnersResponse?.data || [];
|
||||
if (!team?.id) return null;
|
||||
return winners.find((w) => w.team_id === team.id) || null;
|
||||
}, [myTeams, winnersResponse?.data]);
|
||||
|
||||
const handleAcceptInvitation = async (invitationId: string) => {
|
||||
try {
|
||||
await respondToInvitation({ invitationId, action: 'accept' });
|
||||
@@ -134,6 +145,37 @@ const DashboardPage: FC = (): ReactElement => {
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Winner Banner */}
|
||||
{winnerEntry && myTeams.length > 0 && (
|
||||
<div className="mb-8 bg-amber-50 dark:bg-amber-900/20 border-2 border-amber-400 dark:border-amber-500 rounded-lg p-6">
|
||||
<div className="flex items-center justify-between flex-wrap gap-4">
|
||||
<div className="flex items-center space-x-3 flex-1 min-w-0">
|
||||
<span className="text-4xl shrink-0">🏆</span>
|
||||
<div className="min-w-0">
|
||||
<h3 className="font-bold text-amber-900 dark:text-amber-100 text-lg">
|
||||
Selamat! Tim Anda meraih JUARA {winnerEntry.rank}
|
||||
</h3>
|
||||
<p className="text-amber-700 dark:text-amber-300 text-sm">
|
||||
Anda dapat generate sertifikat penghargaan dan
|
||||
membagikannya.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
onClick={async () => {
|
||||
const team = myTeams[0] as { id?: string } | null | undefined;
|
||||
if (!team?.id) return;
|
||||
const certId = await encodeWinnerCertificateId(team.id);
|
||||
navigate(`/certificate/winner/${encodeURIComponent(certId)}`);
|
||||
}}
|
||||
className="shrink-0 px-6 py-2 bg-amber-600 hover:bg-amber-700 dark:bg-amber-600 dark:hover:bg-amber-700 text-white font-medium rounded-lg transition-colors cursor-pointer"
|
||||
>
|
||||
Generate Sertifikat Juara
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Countdown Timer */}
|
||||
{timeLeft && !isSubmissionDeadlinePassed && (
|
||||
<div className="mb-8 bg-blue-50 dark:bg-blue-900/20 border-2 border-blue-500 rounded-lg p-6">
|
||||
@@ -194,7 +236,8 @@ const DashboardPage: FC = (): ReactElement => {
|
||||
<div className="mb-4 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-3">
|
||||
<p className="text-sm text-amber-700 dark:text-amber-300 flex items-center gap-2">
|
||||
<Icon icon="mdi:clock-alert" className="text-lg shrink-0" />
|
||||
Team features are closed. You can no longer accept invitations.
|
||||
Team features are closed. You can no longer accept
|
||||
invitations.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
@@ -263,7 +306,10 @@ const DashboardPage: FC = (): ReactElement => {
|
||||
/>
|
||||
) : (
|
||||
<div className="w-16 h-16 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center shrink-0">
|
||||
<Icon icon="mdi:account-group" className="text-gray-500 dark:text-gray-400 text-2xl" />
|
||||
<Icon
|
||||
icon="mdi:account-group"
|
||||
className="text-gray-500 dark:text-gray-400 text-2xl"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<div className="flex-1 min-w-0">
|
||||
@@ -273,19 +319,33 @@ const DashboardPage: FC = (): ReactElement => {
|
||||
<div className="text-sm text-gray-600 dark:text-gray-400 flex items-center gap-3 font-sans mt-2">
|
||||
{team.has_submission && (
|
||||
<span className="inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 shrink-0">
|
||||
<Icon icon="mdi:check-circle" className="text-sm" />
|
||||
<Icon
|
||||
icon="mdi:check-circle"
|
||||
className="text-sm"
|
||||
/>
|
||||
Submitted
|
||||
</span>
|
||||
)}
|
||||
{team.city && (
|
||||
<span className="flex items-center gap-1 truncate">
|
||||
<Icon icon="mdi:map-marker" className="shrink-0" />
|
||||
<Icon
|
||||
icon="mdi:map-marker"
|
||||
className="shrink-0"
|
||||
/>
|
||||
<span className="truncate">{team.city}</span>
|
||||
</span>
|
||||
)}
|
||||
<span className="flex items-center gap-1 shrink-0">
|
||||
<Icon icon="mdi:account-group" />
|
||||
{team.member_count || team.members?.length || 0} member{(team.member_count || team.members?.length || 0) !== 1 ? 's' : ''}
|
||||
{team.member_count ||
|
||||
team.members?.length ||
|
||||
0}{' '}
|
||||
member
|
||||
{(team.member_count ||
|
||||
team.members?.length ||
|
||||
0) !== 1
|
||||
? 's'
|
||||
: ''}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -15,6 +15,16 @@ export const encodeCertificateId = async (teamId: string, submissionId: string,
|
||||
return encryptText(combined, SECRET_KEY);
|
||||
};
|
||||
|
||||
/**
|
||||
* Encode winner certificate ID (team-based)
|
||||
* @param teamId - Winner team ID
|
||||
* @returns Encoded winner certificate ID
|
||||
*/
|
||||
export const encodeWinnerCertificateId = async (teamId: string): Promise<string> => {
|
||||
const combined = `winner::${teamId}`;
|
||||
return encryptText(combined, SECRET_KEY);
|
||||
};
|
||||
|
||||
/**
|
||||
* Decode certificate ID back to teamId, submissionId, and userId
|
||||
* @param certId - The encoded certificate ID
|
||||
@@ -40,6 +50,27 @@ export const decodeCertificateId = async (certId: string): Promise<{ teamId: str
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Decode winner certificate ID back to teamId
|
||||
* @param certId - The encoded winner certificate ID
|
||||
* @returns Object containing teamId
|
||||
*/
|
||||
export const decodeWinnerCertificateId = async (certId: string): Promise<{ teamId: string }> => {
|
||||
try {
|
||||
const decoded = await decryptText(certId, SECRET_KEY);
|
||||
const parts = decoded.split('::');
|
||||
|
||||
// winner::teamId
|
||||
if (parts.length === 2 && parts[0] === 'winner') {
|
||||
return { teamId: parts[1] };
|
||||
}
|
||||
|
||||
throw new Error('Invalid winner certificate format');
|
||||
} catch {
|
||||
throw new Error('Invalid certificate ID');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* For development: Create a certId using created_at timestamp
|
||||
* @param teamId - The team ID
|
||||
|
||||
Reference in new issue
Block a user