|
| 1 | +--- |
| 2 | +title: Job Board - Pycon India 2025 |
| 3 | +description: PyCon India 2025 Job Board |
| 4 | +layout: base.njk |
| 5 | +--- |
| 6 | + |
| 7 | +{% from "components/flat-card.njk" import flatCard %} |
| 8 | +{% from "components/button.njk" import button %} |
| 9 | + |
| 10 | +<div class="w-full h-auto bg-pycon-blue px-[6%] pb-32 flex flex-col md:flex-row"> |
| 11 | + <div class="pt-32 pb-8 md:pb-32 w-full lg:w-[70%]"> |
| 12 | + <div class="black-han-sans-regular font-normal text-4xl md:text-5xl md:text-center text-[#FFFFFF] text-center lg:text-left"> |
| 13 | + Job Board |
| 14 | + </div> |
| 15 | + <div class="pt-10 font-light text-lg md:text-2xl md:text-center text-white text-center lg:text-left"> |
| 16 | + <p class="mb-0">Submit your job posting <a href="https://docs.google.com/forms/d/e/1FAIpQLSce8d2wOm976llzPUlF3NXzfx4K7zPamnxHSGWup1HDKMA-3g/viewform?usp=dialog" target="_blank" rel="noopener noreferrer" class="underline">here</a></p> |
| 17 | + <p>Check out the <a href="{{ env.baseUrl }}about/job/guidelines/" class="underline">rules and guidelines</a> </p> |
| 18 | + </div> |
| 19 | + </div> |
| 20 | + <div class="lg:w-[30%] w-[80%] lg:mt-40 flex items-center justify-center mx-auto"> |
| 21 | + <img src="/img/assets/abstract-obj.svg" alt="Guide" class="w-[40%] lg:w-[60%] transition-transform duration-100" style="animation: floating 2s ease-in-out infinite;"> |
| 22 | + <img src="/img/assets/star-lime-vector.svg" alt="Guide" class="w-[10%] lg:w-[10%] transition-transform duration-100" style="animation: floating 2s ease-in-out infinite;"> |
| 23 | + </div> |
| 24 | +</div> |
| 25 | + |
| 26 | +<div class="job-container bg-lavender w-full h-auto -pt-20 px-[6%] pb-72 md:pb-40 relative"> |
| 27 | + <div id="job-postings-grid" class="flex flex-wrap -mt-24 -mx-4"> |
| 28 | + <div class="w-full lg:w-1/3 px-4 flex flex-col gap-8" id="column-0"></div> |
| 29 | + <div class="w-full pt-8 lg:pt-16 lg:w-1/3 px-4 flex flex-col gap-8" id="column-1"></div> |
| 30 | + <div class="w-full pt-8 lg:pt-0 lg:w-1/3 px-4 flex flex-col gap-8" id="column-2"></div> |
| 31 | + </div> |
| 32 | +</div> |
| 33 | + |
| 34 | +<script> |
| 35 | + document.addEventListener("DOMContentLoaded", async () => { |
| 36 | + const baseUrl = "{{ env.baseUrl }}"; |
| 37 | +
|
| 38 | + const SPREADSHEET_ID = "1oyMFGGKmR6u5JVpd691iYD_6TuDi3pbvyaajAZfGkGw"; |
| 39 | + const URL = `https://docs.google.com/spreadsheets/d/${SPREADSHEET_ID}/gviz/tq?tqx=out:json`; |
| 40 | +
|
| 41 | + const columnIds = ["column-0", "column-1", "column-2"]; |
| 42 | + const columns = columnIds.map((id) => document.getElementById(id)); |
| 43 | +
|
| 44 | + columns[0].innerHTML = '<p class="text-white">Loading job postings...</p>'; |
| 45 | +
|
| 46 | + const renderJobCard = (job_post, index) => { |
| 47 | + const bg_color = (index % 2 === 1) ? 'bg-pycon-lime' : 'bg-pycon-purple'; |
| 48 | + const button_color = bg_color === "bg-pycon-purple" ? "bg-pycon-lime" : "bg-pycon-purple"; |
| 49 | +
|
| 50 | + return ` |
| 51 | + <div class="relative group w-full max-w-full border border-black ${bg_color} p-8"> |
| 52 | + <div class="text-3xl font-semibold">${job_post.title}</div> |
| 53 | + <div class="pt-4"> |
| 54 | + <span class="text-2xl"> |
| 55 | + <a href="${job_post.company_website}" target="_blank" class="underline"> |
| 56 | + ${job_post.company} |
| 57 | + </a> |
| 58 | + </span> |
| 59 | + <p class="pt-8 flex items-center gap-x-2 mb-0"> |
| 60 | + <i class="fa-solid fa-briefcase text-xl text-[#475569]"></i> |
| 61 | + <span>${job_post.job_type}</span> |
| 62 | + <i class="fa-solid fa-location-dot text-xl text-[#475569]"></i> |
| 63 | + <span>${job_post.location}</span> |
| 64 | + </p> |
| 65 | + </div> |
| 66 | + <div class="pt-2 text-gray-700"> |
| 67 | + <p class="text-justify">${job_post.description}</p> |
| 68 | + </div> |
| 69 | + <div class="pt-4"> |
| 70 | + <a |
| 71 | + href="${job_post.link_to_apply || '#'}" |
| 72 | + target="_blank" |
| 73 | + class="group no-underline inline-flex items-center gap-2 px-4 py-2 ${ |
| 74 | + bg_color === 'bg-pycon-purple' ? 'bg-pycon-lime hover:bg-pycon-lime/90' : 'bg-pycon-purple hover:bg-pycon-purple/90' |
| 75 | + } rounded-full border border-black hover:-translate-y-0.5 hover:shadow-md transition-all duration-300 focus:outline-2 focus:outline-offset-2" |
| 76 | + > |
| 77 | + <span class="font-['Acid_Grotesk'] text-lg ${ |
| 78 | + bg_color === 'bg-pycon-purple' ? 'text-black' : 'text-black' |
| 79 | + } leading-relaxed whitespace-nowrap group-hover:-translate-x-1 transition-transform duration-200"> |
| 80 | + Apply |
| 81 | + </span> |
| 82 | + <div class="flex justify-center items-center w-8 h-8 bg-white rounded-full border border-black group-hover:rotate-40 transition-transform duration-300"> |
| 83 | + <img src="${baseUrl}img/assets/arrow-vector.svg" alt="Arrow" class="w-4 h-3 group-hover:scale-110 transition-transform duration-300" /> |
| 84 | + </div> |
| 85 | + </a> |
| 86 | + </div> |
| 87 | + </div> |
| 88 | + `; |
| 89 | + }; |
| 90 | +
|
| 91 | + try { |
| 92 | + const response = await fetch(URL); |
| 93 | + const text = await response.text(); |
| 94 | +
|
| 95 | + const jsonString = text.substring(47).slice(0, -2); |
| 96 | + const json = JSON.parse(jsonString); |
| 97 | + const rows = json.table.rows; |
| 98 | +
|
| 99 | + const ensureHttps = (url) => { |
| 100 | + if (!/^https?:\/\//.test(url)) { |
| 101 | + return `https://${url}`; |
| 102 | + } |
| 103 | + return url; |
| 104 | + }; |
| 105 | +
|
| 106 | + const isValidUrl = (url) => { |
| 107 | + const pattern = /^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(:\d+)?(\/.*)?$/; |
| 108 | + return pattern.test(url); |
| 109 | + }; |
| 110 | +
|
| 111 | + const jobPostings = rows.map((row) => ({ |
| 112 | + title: row.c[1]?.v || "No title", |
| 113 | + company: row.c[2]?.v || "Unknown", |
| 114 | + company_website: ensureHttps(row.c[3]?.v) || "#", |
| 115 | + job_type: row.c[4]?.v || "N/A", |
| 116 | + location: row.c[5]?.v || "Unknown", |
| 117 | + description: row.c[6]?.v || "No description available", |
| 118 | + link_to_apply: ensureHttps(row.c[7]?.v) || "#", |
| 119 | + })) |
| 120 | + .filter((job_post) => |
| 121 | + isValidUrl(job_post.company_website) && |
| 122 | + isValidUrl(job_post.link_to_apply) |
| 123 | + ); |
| 124 | +
|
| 125 | + columns[0].innerHTML = ""; |
| 126 | +
|
| 127 | + if (jobPostings.length === 0) { |
| 128 | + columns[0].innerHTML = ` |
| 129 | + <p class="text-white"> |
| 130 | + No available jobs at the moment. Please check back later. |
| 131 | + </p>`; |
| 132 | + } else { |
| 133 | + jobPostings.forEach((job_post, index) => { |
| 134 | + const columnIndex = index % 3; |
| 135 | + if (columns[columnIndex]) { |
| 136 | + columns[columnIndex].innerHTML += renderJobCard(job_post, index); |
| 137 | + } |
| 138 | + }); |
| 139 | + } |
| 140 | + } catch (error) { |
| 141 | + console.error("Error fetching job data:", error); |
| 142 | + columns.forEach((col) => { |
| 143 | + col.innerHTML = '<p class="text-red-500 text-center">Failed to load job postings. Please try again later.</p>'; |
| 144 | + }); |
| 145 | + } |
| 146 | + }); |
| 147 | +</script> |
0 commit comments