mirror of
https://github.com/ivabus/www
synced 2024-11-10 14:45:14 +03:00
Merge pull request #126 from teaxyz/feature/add-sorting-data
* add sorting data to generated packages.json * attach data to package thumbs
This commit is contained in:
commit
cc91e49be2
|
@ -24,40 +24,13 @@ export const getAllAirtablePackages = async (): Promise<AirtablePackage[]> => {
|
||||||
'version',
|
'version',
|
||||||
'last_modified',
|
'last_modified',
|
||||||
'full_name',
|
'full_name',
|
||||||
|
'dl_count',
|
||||||
]),
|
]),
|
||||||
maintainer: record.fields?.maintainer || '',
|
maintainer: record.fields?.maintainer || '',
|
||||||
desc: record.fields?.desc || '',
|
desc: record.fields?.desc || '',
|
||||||
thumb_image_url: _.get(record.fields, 'thumb_image[0].url', '/Images/package-thumb-nolabel3.jpg')
|
thumb_image_url: _.get(record.fields, 'thumb_image[0].url', '/Images/package-thumb-nolabel3.jpg')
|
||||||
} as AirtablePackage;
|
} as AirtablePackage;
|
||||||
});
|
});
|
||||||
/**
|
|
||||||
* // SAMPLE RECORD SHAPE w/ thumb_image is uploaded
|
|
||||||
{
|
|
||||||
slug: 'unicode_org',
|
|
||||||
name: 'unicode.org',
|
|
||||||
full_name: 'unicode.org',
|
|
||||||
homepage: 'https://unicode.org',
|
|
||||||
version: '71.1.1',
|
|
||||||
last_modified: '2022-09-26T19:46:25.000Z',
|
|
||||||
thumb_image: [
|
|
||||||
{
|
|
||||||
id: 'attQVgaRUXOYinsWy',
|
|
||||||
width: 640,
|
|
||||||
height: 534,
|
|
||||||
url: 'https://dl.airtable.com/.attachments/f2465c36a0060919368e2f53305694f9/cfab76a8/gen-art-1.png',
|
|
||||||
filename: 'gen-art-1.png',
|
|
||||||
size: 184878,
|
|
||||||
type: 'image/png',
|
|
||||||
thumbnails: [Object]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
TODO IMAGE UPLOAD to S3/CDN:
|
|
||||||
if thumb_image_url is empty
|
|
||||||
get thumb_image data
|
|
||||||
upload to s3
|
|
||||||
update thumb_image_url in airtable
|
|
||||||
*/
|
|
||||||
return packages;
|
return packages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +46,7 @@ export const insertPackagesToAirtable = async (newPackages: Partial<AirtablePack
|
||||||
fields: {
|
fields: {
|
||||||
...fields,
|
...fields,
|
||||||
last_modified: fields.last_modified.toString(),
|
last_modified: fields.last_modified.toString(),
|
||||||
|
dl_count: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,6 +13,7 @@ export type AirtablePackage = S3Package & {
|
||||||
airtable_record_id: string,
|
airtable_record_id: string,
|
||||||
thumb_image_url: string,
|
thumb_image_url: string,
|
||||||
desc: string,
|
desc: string,
|
||||||
|
dl_count: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Package = Omit<AirtablePackage, 'airtable_record_id'> & {
|
export type Package = Omit<AirtablePackage, 'airtable_record_id'> & {
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
"version": "2.5.1",
|
"version": "2.5.1",
|
||||||
"installs": 3986221,
|
"installs": 3986221,
|
||||||
"maintainer": "",
|
"maintainer": "",
|
||||||
"thumb_image_url": "/Images/package-thumb-nolabel.jpg"
|
"thumb_image_url": "/Images/package-thumb-nolabel.jpg",
|
||||||
|
"dl_count": 1,
|
||||||
|
"last_modified": "2022-09-26T19:46:25.000Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "svg2png",
|
"name": "svg2png",
|
||||||
|
@ -17,7 +19,9 @@
|
||||||
"version": "0.1.3",
|
"version": "0.1.3",
|
||||||
"installs": 1233,
|
"installs": 1233,
|
||||||
"maintainer": "pascal",
|
"maintainer": "pascal",
|
||||||
"thumb_image_url": "/Images/package-thumb-nolabel4.jpg"
|
"thumb_image_url": "/Images/package-thumb-nolabel4.jpg",
|
||||||
|
"dl_count": 2,
|
||||||
|
"last_modified": "2022-09-30T15:39:15.000Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "cmake",
|
"name": "cmake",
|
||||||
|
@ -27,7 +31,9 @@
|
||||||
"version": "3.24.2",
|
"version": "3.24.2",
|
||||||
"installs": 1729267,
|
"installs": 1729267,
|
||||||
"maintainer": "pascal",
|
"maintainer": "pascal",
|
||||||
"thumb_image_url": "/Images/package-thumb-nolabel3.jpg"
|
"thumb_image_url": "/Images/package-thumb-nolabel3.jpg",
|
||||||
|
"dl_count": 3,
|
||||||
|
"last_modified": "2022-09-27:39:15.000Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "h2c",
|
"name": "h2c",
|
||||||
|
@ -37,7 +43,9 @@
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"installs": 96,
|
"installs": 96,
|
||||||
"maintainer": "h2o",
|
"maintainer": "h2o",
|
||||||
"thumb_image_url": "/Images/package-thumb-nolabel.jpg"
|
"thumb_image_url": "/Images/package-thumb-nolabel.jpg",
|
||||||
|
"dl_count": 4,
|
||||||
|
"last_modified": "2022-09-25:39:15.000Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "libmagic",
|
"name": "libmagic",
|
||||||
|
@ -47,7 +55,9 @@
|
||||||
"version": "5.43",
|
"version": "5.43",
|
||||||
"installs": 162436,
|
"installs": 162436,
|
||||||
"maintainer": "",
|
"maintainer": "",
|
||||||
"thumb_image_url": "/Images/package-thumb-nolabel3.jpg"
|
"thumb_image_url": "/Images/package-thumb-nolabel3.jpg",
|
||||||
|
"dl_count": 5,
|
||||||
|
"last_modified": "2022-09-24:39:15.000Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "deno",
|
"name": "deno",
|
||||||
|
@ -57,7 +67,9 @@
|
||||||
"version": "1.26.1",
|
"version": "1.26.1",
|
||||||
"installs": 204033,
|
"installs": 204033,
|
||||||
"maintainer": "Ryan Dahl",
|
"maintainer": "Ryan Dahl",
|
||||||
"thumb_image_url": "/Images/package-thumb-nolabel2.jpg"
|
"thumb_image_url": "/Images/package-thumb-nolabel2.jpg",
|
||||||
|
"dl_count": 6,
|
||||||
|
"last_modified": "2022-09-23:39:15.000Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "fontconfig",
|
"name": "fontconfig",
|
||||||
|
@ -67,7 +79,9 @@
|
||||||
"version": "2.14.0",
|
"version": "2.14.0",
|
||||||
"installs": 2485083,
|
"installs": 2485083,
|
||||||
"maintainer": "Max Miedinger",
|
"maintainer": "Max Miedinger",
|
||||||
"thumb_image_url": "/Images/package-thumb-nolabel.jpg"
|
"thumb_image_url": "/Images/package-thumb-nolabel.jpg",
|
||||||
|
"dl_count": 7,
|
||||||
|
"last_modified": "2022-09-22:39:15.000Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pkg-config",
|
"name": "pkg-config",
|
||||||
|
@ -77,7 +91,9 @@
|
||||||
"version": "0.29.2",
|
"version": "0.29.2",
|
||||||
"installs": 2634164,
|
"installs": 2634164,
|
||||||
"maintainer": "pascal",
|
"maintainer": "pascal",
|
||||||
"thumb_image_url": "/Images/package-thumb-nolabel4.jpg"
|
"thumb_image_url": "/Images/package-thumb-nolabel4.jpg",
|
||||||
|
"dl_count": 8,
|
||||||
|
"last_modified": "2022-09-21:39:15.000Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "shared-mime-info",
|
"name": "shared-mime-info",
|
||||||
|
@ -87,7 +103,9 @@
|
||||||
"version": "2.2",
|
"version": "2.2",
|
||||||
"installs": 642619,
|
"installs": 642619,
|
||||||
"maintainer": "Mr.Mime",
|
"maintainer": "Mr.Mime",
|
||||||
"thumb_image_url": "/Images/package-thumb-nolabel3.jpg"
|
"thumb_image_url": "/Images/package-thumb-nolabel3.jpg",
|
||||||
|
"dl_count": 9,
|
||||||
|
"last_modified": "2022-09-21:39:15.000Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "ttfautohint",
|
"name": "ttfautohint",
|
||||||
|
@ -97,7 +115,9 @@
|
||||||
"version": "1.8.4",
|
"version": "1.8.4",
|
||||||
"installs": 4696,
|
"installs": 4696,
|
||||||
"maintainer": "pascal",
|
"maintainer": "pascal",
|
||||||
"thumb_image_url": "/Images/package-thumb-nolabel.jpg"
|
"thumb_image_url": "/Images/package-thumb-nolabel.jpg",
|
||||||
|
"dl_count": 10,
|
||||||
|
"last_modified": "2022-09-20:39:15.000Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "numactl",
|
"name": "numactl",
|
||||||
|
@ -107,7 +127,9 @@
|
||||||
"version": "2.0.16",
|
"version": "2.0.16",
|
||||||
"installs": 1120,
|
"installs": 1120,
|
||||||
"maintainer": "FSS",
|
"maintainer": "FSS",
|
||||||
"thumb_image_url": "/Images/package-thumb-nolabel2.jpg"
|
"thumb_image_url": "/Images/package-thumb-nolabel2.jpg",
|
||||||
|
"dl_count": 11,
|
||||||
|
"last_modified": "2022-09-19:39:15.000Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "flex",
|
"name": "flex",
|
||||||
|
@ -117,6 +139,8 @@
|
||||||
"version": "2.6.4",
|
"version": "2.6.4",
|
||||||
"installs": 35001,
|
"installs": 35001,
|
||||||
"maintainer": "",
|
"maintainer": "",
|
||||||
"thumb_image_url": "/Images/package-thumb-nolabel4.jpg"
|
"thumb_image_url": "/Images/package-thumb-nolabel4.jpg",
|
||||||
|
"dl_count": 12,
|
||||||
|
"last_modified": "2022-09-18:39:15.000Z"
|
||||||
}
|
}
|
||||||
]
|
]
|
|
@ -1,4 +1,4 @@
|
||||||
<div class="card card-thumbnail" style="width: 100%">
|
<div class="card card-thumbnail" style="width: 100%" popularity="{{- .dl_count -}}" last_modified="{{- .last_modified -}}">
|
||||||
<figure class="card-img-top" >
|
<figure class="card-img-top" >
|
||||||
<img class="package-image" src="{{- .thumb_image_url -}}" alt="{{- .name -}}" style="width:100%; height:100%;">
|
<img class="package-image" src="{{- .thumb_image_url -}}" alt="{{- .name -}}" style="width:100%; height:100%;">
|
||||||
<article class="card-thumb-label">
|
<article class="card-thumb-label">
|
||||||
|
|
Loading…
Reference in a new issue