Skip to content

Commit

Permalink
Update packages
Browse files Browse the repository at this point in the history
  • Loading branch information
patdx committed Mar 27, 2023
1 parent 2634cda commit 368c428
Show file tree
Hide file tree
Showing 15 changed files with 1,907 additions and 2,072 deletions.
340 changes: 259 additions & 81 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

783 changes: 0 additions & 783 deletions .yarn/releases/yarn-3.2.3.cjs

This file was deleted.

873 changes: 873 additions & 0 deletions .yarn/releases/yarn-3.5.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.2.3.cjs
yarnPath: .yarn/releases/yarn-3.5.0.cjs
20 changes: 12 additions & 8 deletions components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Link from 'next/link';
import React, { ReactNode } from 'react';
import { Collapse, Container, Nav, Navbar, NavItem, NavLink } from 'reactstrap';
import logoSvg from '../assets/logo.svg';
import Image from 'next/image';
import Image from 'next/legacy/image';

export const Layout: React.FunctionComponent<{
children?: ReactNode;
Expand All @@ -19,27 +19,31 @@ export const Layout: React.FunctionComponent<{

<Container>
<Navbar expand="sm" className="px-0">
<Link href="/" passHref>
<a className="navbar-brand">
<Image aria-label="Gomitrack" src={logoSvg} unoptimized width={200} height={40} />
{/* <img
<Link href="/" passHref className="navbar-brand">
<Image
aria-label="Gomitrack"
src={logoSvg}
unoptimized
width={200}
height={40}
/>
{/* <img
aria-label="Gomitrack"
src="/images/logo4.svg"
style={{ width: '200px', height: '40px' }}
/> */}
</a>
</Link>

<Collapse isOpen={true} navbar>
<Nav navbar>
<NavItem>
<Link href="/" passHref>
<Link href="/" passHref legacyBehavior>
<NavLink>Districts</NavLink>
</Link>
</NavItem>

<NavItem>
<Link href="/about" passHref>
<Link href="/about" passHref legacyBehavior>
<NavLink>About</NavLink>
</Link>
</NavItem>
Expand Down
5 changes: 1 addition & 4 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { merge } = require('webpack-merge');
const { PHASE_DEVELOPMENT_SERVER } = require('next/constants');
require('dotenv').config();
// require('dotenv').config();

module.exports = (phase) => ({
env: (() => {
Expand Down Expand Up @@ -38,7 +38,4 @@ module.exports = (phase) => ({

return output;
},
future: {
webpack5: true,
},
});
51 changes: 26 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,45 @@
"dependencies": {
"@turf/bbox": "6.5.0",
"@turf/helpers": "6.5.0",
"@types/fs-extra": "9.0.13",
"@types/fs-extra": "11.0.1",
"@types/lowdb": "1.0.11",
"@types/url-join": "4.0.1",
"bootstrap": "5.2.1",
"bootstrap": "5.2.3",
"date-fns": "2.29.3",
"dotenv": "16.0.3",
"fs-extra": "10.1.0",
"immer": "9.0.15",
"isomorphic-unfetch": "3.1.0",
"leaflet": "1.9.1",
"fs-extra": "11.1.1",
"immer": "9.0.21",
"leaflet": "1.9.3",
"lodash": "4.17.21",
"mingo": "6.1.1",
"next": "12.3.1",
"luxon": "^3.3.0",
"mingo": "6.3.0",
"next": "13.2.4",
"original-url": "1.2.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-leaflet": "4.1.0",
"reactstrap": "9.1.4",
"rrule": "2.7.0",
"react-leaflet": "4.2.1",
"reactstrap": "9.1.6",
"rrule": "2.7.2",
"url-join": "5.0.0",
"webpack-merge": "5.8.0"
},
"devDependencies": {
"@babel/cli": "7.19.3",
"@babel/core": "7.19.3",
"@babel/plugin-proposal-decorators": "7.19.3",
"@types/leaflet": "1.8.0",
"@types/lodash": "4.14.186",
"@types/node": "16.11.63",
"@types/react": "18.0.21",
"@types/react-dom": "18.0.6",
"@babel/cli": "7.21.0",
"@babel/core": "7.21.3",
"@babel/plugin-proposal-decorators": "7.21.0",
"@types/leaflet": "1.9.3",
"@types/lodash": "4.14.191",
"@types/luxon": "^3.2.0",
"@types/node": "18.15.10",
"@types/react": "18.0.29",
"@types/react-dom": "18.0.11",
"@types/webpack": "5.28.0",
"eslint": "8.24.0",
"eslint-config-next": "12.3.1",
"fp-ts": "2.12.3",
"typescript": "4.8.4",
"webpack": "5.74.0"
"eslint": "8.36.0",
"eslint-config-next": "13.2.4",
"fp-ts": "2.13.1",
"typescript": "5.0.2",
"webpack": "5.76.3"
},
"license": "ISC",
"packageManager": "yarn@3.2.3"
"packageManager": "yarn@3.5.0"
}
5 changes: 1 addition & 4 deletions pages/districts/[district].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,7 @@ const DistrictPage: NextPage<{

export const getServerSideProps: GetServerSideProps = async (context) => {
const districtName = context.query.district as string;
const district = await findDistrictWithSortedSchedule(
districtName,
context.req
);
const district = await findDistrictWithSortedSchedule(districtName);

if (!district) {
throw new Error(`could not find district ${districtName}`);
Expand Down
33 changes: 14 additions & 19 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ const IndexPage: NextPage<{ districts: CollectionDistrict[] }> = ({
<div className="row gy-2" key={index}>
<div className="col-xs-12 col-sm-3 col-md-3 col-lg-3">
<h2 className="h-100">
<Link href="/districts/[district]" as={`/districts/${name}`}>
<a className="btn h-100 btn-lg d-block text-start btn-outline-light text-dark">
<div>{nameJP}</div>
<div>{name}</div>
</a>
<Link
href={`/districts/${name}`}
className="btn h-100 btn-lg d-block text-start btn-outline-light text-dark"
>
<div>{nameJP}</div>
<div>{name}</div>
</Link>
</h2>
</div>
Expand All @@ -45,22 +46,16 @@ const IndexPage: NextPage<{ districts: CollectionDistrict[] }> = ({
key={index}
>
<Link
href={{
pathname: '/districts/[district]',
query: {
district: name,
},
}}
href={`/districts/${encodeURIComponent(name)}`}
className="card p-0 shadow-sm text-decoration-none text-start btn btn-outline-light"
>
<a className="card p-0 shadow-sm text-decoration-none text-start btn btn-outline-light">
<div className="card-body">
<div className="text-dark">{addressJP}</div>
<div className="text-muted">{address}</div>
<div className="text-black-50">
{formatZip(addressItem)}
</div>
<div className="card-body">
<div className="text-dark">{addressJP}</div>
<div className="text-muted">{address}</div>
<div className="text-black-50">
{formatZip(addressItem)}
</div>
</a>
</div>
</Link>
</div>
);
Expand Down
21 changes: 8 additions & 13 deletions utils/collection-district.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { pipe } from 'fp-ts/pipeable';
import { IncomingMessage } from 'http';
import { pipe } from 'fp-ts/function';
import produce from 'immer';
import { find } from 'mingo';
import { CollectionArea } from './collection-area';
Expand All @@ -25,13 +24,12 @@ export const mapLocations = (district: CollectionDistrict) => {
});
};

export const findDistrict = async (
districtName: string,
req?: IncomingMessage
) => {
const db = await getDatabase(req);
export const findDistrict = async (districtName: string) => {
const db = await getDatabase();
const district = pipe(
find(db.districts ?? [], { name: districtName }).next() as CollectionDistrict,
find(db.districts ?? [], {
name: districtName,
}).next() as CollectionDistrict,
(district) =>
produce(district, (draft) => {
draft.garbages.forEach((garbage) => {
Expand All @@ -46,11 +44,8 @@ export const findDistrict = async (
return district;
};

export const findDistrictWithSortedSchedule = async (
districtName: string,
req?: IncomingMessage
) => {
const district = await findDistrict(districtName, req);
export const findDistrictWithSortedSchedule = async (districtName: string) => {
const district = await findDistrict(districtName);
if (!district) {
return;
}
Expand Down
11 changes: 6 additions & 5 deletions utils/database.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { IncomingMessage } from 'http';
import { memoize } from 'lodash';
import { CollectionDistrict } from './collection-district';
import { fetchJson } from './fetch';
import { GarbageType } from './garbage-type';

export const getDatabase = memoize(async (req?: IncomingMessage) => {
const db = await fetchJson({ req, src: '/db.json' });
export const getDatabase = memoize(async () => {
const db = await import('./db.json');
return db.default;
// const db = await fetchJson({ req, src: '/db.json' });

return db;
// return db;
});

export interface AppDatabase {
garbages?: GarbageType[];
districts?: CollectionDistrict[];
Expand Down
File renamed without changes.
55 changes: 0 additions & 55 deletions utils/fetch.ts

This file was deleted.

24 changes: 13 additions & 11 deletions utils/garbage-type-frequency.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import RRule from 'rrule';
import { GarbageType } from "./garbage-type";
import { format } from 'date-fns';
import { RRule } from 'rrule';
import { GarbageType } from './garbage-type';
import { DateTime } from 'luxon';

export interface GarbageTypeFrequency {
garbage: string | GarbageType;
Expand All @@ -21,16 +21,18 @@ export const nextDate = (garbageItem: GarbageTypeFrequency) => {
const rrule = RRule.fromString(garbageItem.frequencyRRule);
const nextDateInFakeUtc = rrule.after(dateInFakeUtc, true);

const nextDate = new Date(
nextDateInFakeUtc.getUTCFullYear(),
nextDateInFakeUtc.getUTCMonth(),
nextDateInFakeUtc.getUTCDate()
);
console.log(nextDateInFakeUtc, JSON.stringify(nextDateInFakeUtc));
console.log(nextDate, JSON.stringify(nextDate));
// TODO: review is this is corrcct
const nextDate = DateTime.fromJSDate(nextDateInFakeUtc!)
.toUTC()
.setZone('local', { keepLocalTime: true })
.setZone('Asia/Tokyo');

console.log('fake next date:', nextDateInFakeUtc, 'real next date', nextDate);

return nextDate;
};

export const nextDateFormatted = (garbageItem: GarbageTypeFrequency) => {
return format(nextDate(garbageItem), 'PPPP');
return nextDate(garbageItem).toLocaleString(DateTime.DATE_FULL);
// return format(nextDate(garbageItem), 'PPPP');
};
Loading

1 comment on commit 368c428

@vercel
Copy link

@vercel vercel bot commented on 368c428 Mar 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

gomitrack – ./

gomitrack.vercel.app
gomitrack-git-master-patdx.vercel.app
gomitrack-patdx.vercel.app

Please sign in to comment.