From a3c1201009362e0c4e8b04d71c63c0480bcaf56a Mon Sep 17 00:00:00 2001 From: namedotget Date: Wed, 20 Nov 2024 16:09:15 -0600 Subject: [PATCH 1/3] Append mailto: if contactInfo is an email --- ui/components/subscription/TeamJobModal.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ui/components/subscription/TeamJobModal.tsx b/ui/components/subscription/TeamJobModal.tsx index c2562b2fc..e039f98cc 100644 --- a/ui/components/subscription/TeamJobModal.tsx +++ b/ui/components/subscription/TeamJobModal.tsx @@ -95,6 +95,17 @@ export default function TeamJobModal({ const cleanedData = cleanData(jobData) + //Check if the contact info is an email and append mailto: if needed + let formattedContactInfo + if ( + cleanedData.contactInfo.includes('@') && + !cleanedData.contactInfo.startsWith('mailto:') + ) { + formattedContactInfo = `mailto:${cleanedData.contactInfo}` + } else { + formattedContactInfo = cleanedData.contactInfo + } + try { if (edit) { await jobTableContract.call('updateTable', [ @@ -106,7 +117,7 @@ export default function TeamJobModal({ '', endTime, currTime, - cleanedData.contactInfo, + formattedContactInfo, ]) } else { await jobTableContract?.call('insertIntoTable', [ @@ -117,7 +128,7 @@ export default function TeamJobModal({ '', endTime, currTime, - cleanedData.contactInfo, + formattedContactInfo, ]) } From 59a17bcee8cd7b22611a90fc22237ddbe4a5317f Mon Sep 17 00:00:00 2001 From: namedotget Date: Wed, 20 Nov 2024 16:10:12 -0600 Subject: [PATCH 2/3] Order jobs and listings by id in reverse --- ui/components/subscription/LatestJobs.tsx | 4 ++-- ui/components/subscription/NewMarketplaceListings.tsx | 4 ++-- ui/pages/jobs.tsx | 2 +- ui/pages/marketplace/index.tsx | 4 +++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ui/components/subscription/LatestJobs.tsx b/ui/components/subscription/LatestJobs.tsx index 67c4dd066..25e22d3de 100644 --- a/ui/components/subscription/LatestJobs.tsx +++ b/ui/components/subscription/LatestJobs.tsx @@ -22,7 +22,7 @@ export default function LatestJobs({ async function getLatestJobs() { const now = Math.floor(Date.now() / 1000) const tableName = await jobTableContract.call('getTableName') - const statement = `SELECT * FROM ${tableName} WHERE (endTime = 0 OR endTime >= ${now}) ORDER BY timestamp ASC LIMIT 25` + const statement = `SELECT * FROM ${tableName} WHERE (endTime = 0 OR endTime >= ${now}) ORDER BY id DESC LIMIT 25` const latestJobsRes = await fetch( `${TABLELAND_ENDPOINT}?statement=${statement}` ) @@ -33,7 +33,7 @@ export default function LatestJobs({ ]) return teamExpiration.toNumber() > now }) - setLatestJobs(validJobs.reverse()) + setLatestJobs(validJobs) } if (teamContract && jobTableContract) { getLatestJobs() diff --git a/ui/components/subscription/NewMarketplaceListings.tsx b/ui/components/subscription/NewMarketplaceListings.tsx index c68a6bb62..da83f9c12 100644 --- a/ui/components/subscription/NewMarketplaceListings.tsx +++ b/ui/components/subscription/NewMarketplaceListings.tsx @@ -24,7 +24,7 @@ export default function NewMarketplaceListings({ async function getNewMarketplaceListings() { const now = Math.floor(Date.now() / 1000) const tableName = await marketplaceTableContract.call('getTableName') - const statement = `SELECT * FROM ${tableName} WHERE (startTime = 0 OR startTime <= ${now}) AND (endTime = 0 OR endTime >= ${now}) ORDER BY timestamp ASC LIMIT 25` + const statement = `SELECT * FROM ${tableName} WHERE (startTime = 0 OR startTime <= ${now}) AND (endTime = 0 OR endTime >= ${now}) ORDER BY id DESC LIMIT 25` const allListingsRes = await fetch( `${TABLELAND_ENDPOINT}?statement=${statement}` ) @@ -37,7 +37,7 @@ export default function NewMarketplaceListings({ return teamExpiration.toNumber() > now } ) - setNewListings(validListings.reverse()) + setNewListings(validListings) } if (teamContract && marketplaceTableContract) { getNewMarketplaceListings() diff --git a/ui/pages/jobs.tsx b/ui/pages/jobs.tsx index d77d8b515..fd7ddea91 100644 --- a/ui/pages/jobs.tsx +++ b/ui/pages/jobs.tsx @@ -125,7 +125,7 @@ export async function getStaticProps() { const jobBoardTableName = await jobTableContract.call('getTableName') - const statement = `SELECT * FROM ${jobBoardTableName} WHERE (endTime = 0 OR endTime >= ${now})` + const statement = `SELECT * FROM ${jobBoardTableName} WHERE (endTime = 0 OR endTime >= ${now}) ORDER BY id DESC` const allJobsRes = await fetch(`${TABLELAND_ENDPOINT}?statement=${statement}`) const allJobs = await allJobsRes.json() diff --git a/ui/pages/marketplace/index.tsx b/ui/pages/marketplace/index.tsx index e345a551e..8d93e0881 100644 --- a/ui/pages/marketplace/index.tsx +++ b/ui/pages/marketplace/index.tsx @@ -119,13 +119,15 @@ export async function getStaticProps() { 'getTableName' ) - const statement = `SELECT * FROM ${marketplaceTableName} WHERE (startTime = 0 OR startTime <= ${now}) AND (endTime = 0 OR endTime >= ${now})` + const statement = `SELECT * FROM ${marketplaceTableName} WHERE (startTime = 0 OR startTime <= ${now}) AND (endTime = 0 OR endTime >= ${now}) ORDER BY id DESC` const allListingsRes = await fetch( `${TABLELAND_ENDPOINT}?statement=${statement}` ) const allListings = await allListingsRes.json() + console.log('allListings', allListings) + const validListings = allListings.filter(async (listing: TeamListingType) => { const teamExpiration = await teamContract.call('expiresAt', [ listing.teamId, From 07417ae00a949bb6076c3d256ba567c4b8e61f5a Mon Sep 17 00:00:00 2001 From: namedotget Date: Sat, 23 Nov 2024 14:22:55 -0600 Subject: [PATCH 3/3] Removed log --- ui/pages/marketplace/index.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/ui/pages/marketplace/index.tsx b/ui/pages/marketplace/index.tsx index 8d93e0881..f94f4be00 100644 --- a/ui/pages/marketplace/index.tsx +++ b/ui/pages/marketplace/index.tsx @@ -126,8 +126,6 @@ export async function getStaticProps() { ) const allListings = await allListingsRes.json() - console.log('allListings', allListings) - const validListings = allListings.filter(async (listing: TeamListingType) => { const teamExpiration = await teamContract.call('expiresAt', [ listing.teamId,