import { StarIcon } from '@heroicons/react/24/outline';
import { getCollection, getMetaobjectsByIds } from 'lib/shopify';
import { Collection, Metaobject } from 'lib/shopify/types';
import Link from 'next/link';
const { STORE_PREFIX } = process.env;
const validStores = ['car-part-planet', 'reman-transmission', 'transmission-locator'];
const LinkBlock = async ({ collectionId, title }: { collectionId?: string; title?: string }) => {
if (!collectionId || !title) return null;
const collection = await getCollection({ id: collectionId });
if (!collection) return null;
return (
{title}
);
};
const TransmissionCode = async ({ collection }: { collection: Collection }) => {
if (!collection.plpType || !validStores.includes(STORE_PREFIX!)) {
return null;
}
let transmissionCodes = [] as Metaobject[];
if (
(collection.plpType === 'Product Type' || collection.plpType === 'Make') &&
collection.transmissionCodeLinks
) {
transmissionCodes = await getMetaobjectsByIds(collection.transmissionCodeLinks);
}
if (!transmissionCodes.length) {
return null;
}
return (
Browse By Transmission Code
Popular Transmission Codes
{transmissionCodes.map((transmissionCode) => (
))}
);
};
export default TransmissionCode;