mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* update styles for chain widgets on home page * update latest txs styles and slug creation algorithm * list of local txs * list of local blocks * local view for address internal tx tab * local view for address coin history * local view for address logs * local view for address token transfers * address details, kind of * [wip] local view for address contract tab * user ops views * chain popover * csv-export page * advanced filter page * block countdown pages * fixes for contract tab * refactor address txs and transfers tabs * refactor getServerSideProps * internal txs page * tokens and token transfers pages * simple tag for address page and details info placeholders * add chain icon to the local lists * show creator in contract tab * OP Superchain: local views for chains in the cluster Fixes #2827 * highlight current chain in the title of local entities * tokens nfts tab for address * allow entity icon to be an image * adjust cross-chain txs table and add placeholder to home page * cross-chain txs for address * fetch multichain config from microservice * fix skeleton in token transfers table * tests, pt.1 * wtf with gh * verified contracts page * change chain info in block and token page header * fix some tests * update styles for token icon with chain logo in header * fix links and address internal txs tab * update screenshots * fix margins for tx info button and chain icon in tx tables * add some tests * fix screenshots
36 lines
1.4 KiB
TypeScript
36 lines
1.4 KiB
TypeScript
import { route } from 'nextjs/routes';
|
|
|
|
import config from 'configs/app';
|
|
import type { TMultichainContext } from 'lib/contexts/multichain';
|
|
import dayjs from 'lib/date/dayjs';
|
|
|
|
interface Params {
|
|
timeFromNow: number;
|
|
blockHeight: string;
|
|
multichainContext?: TMultichainContext | null;
|
|
}
|
|
|
|
const DATE_FORMAT = 'YYYYMMDDTHHmm';
|
|
|
|
export default function createGoogleCalendarLink({ timeFromNow, blockHeight, multichainContext }: Params): string {
|
|
|
|
const chainConfig = multichainContext?.chain.config || config;
|
|
|
|
const date = dayjs().add(timeFromNow, 's');
|
|
const name = `Block #${ blockHeight } reminder | ${ chainConfig.chain.name }`;
|
|
const description = `#${ blockHeight } block creation time on ${ chainConfig.chain.name } blockchain.`;
|
|
const startTime = date.format(DATE_FORMAT);
|
|
const endTime = date.add(15, 'minutes').format(DATE_FORMAT);
|
|
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
const blockUrl = config.app.baseUrl + route({ pathname: '/block/[height_or_hash]', query: { height_or_hash: blockHeight } }, multichainContext);
|
|
|
|
const url = new URL('calendar/render', 'https://www.google.com/');
|
|
url.searchParams.append('action', 'TEMPLATE');
|
|
url.searchParams.append('text', name);
|
|
url.searchParams.append('details', description + '\n' + blockUrl);
|
|
url.searchParams.append('dates', `${ startTime }/${ endTime }`);
|
|
url.searchParams.append('ctz', timeZone);
|
|
|
|
return url.toString();
|
|
}
|