From 479ecda356381fb200043524de5dc0f3cff22c3b Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Mon, 5 Aug 2024 16:56:18 +0100
Subject: [PATCH 01/16] ar(feat) [DPCP-38] [DPCP-39] [DPCP-46]: Abstract Views
---
.../client/elements/calendar-view.tsx | 86 +++++++++++++++++
src/app/components/client/elements/index.ts | 5 +-
.../{hypnos-list-view.tsx => list-view.tsx} | 0
.../components/client/elements/map-view.tsx | 86 +++++++++++++++++
.../client/elements/rm-list-view.tsx | 93 -------------------
5 files changed, 175 insertions(+), 95 deletions(-)
create mode 100644 src/app/components/client/elements/calendar-view.tsx
rename src/app/components/client/elements/{hypnos-list-view.tsx => list-view.tsx} (100%)
create mode 100644 src/app/components/client/elements/map-view.tsx
delete mode 100644 src/app/components/client/elements/rm-list-view.tsx
diff --git a/src/app/components/client/elements/calendar-view.tsx b/src/app/components/client/elements/calendar-view.tsx
new file mode 100644
index 00000000..54061b7c
--- /dev/null
+++ b/src/app/components/client/elements/calendar-view.tsx
@@ -0,0 +1,86 @@
+// hypnos-list-view.tsx
+'use client';
+import type { ICard } from '@dreampipcom/oneiros';
+import type { IDPayload } from '@types';
+
+import { useContext, useEffect, useRef, useMemo } from 'react';
+
+import { clsx } from 'clsx';
+import Image from 'next/image';
+import { HypnosPublicContext, AuthContext, GlobalContext } from '@state';
+import { ALoadPublicListings, AUnloadPublicListings, ADecoratePublicListings, AAddToFavoritePublicListings } from '@actions';
+import { navigate, addToFavorites, loadHypnosPublicListings } from '@gateway';
+import { CardGrid as DPCardGrid } from "@dreampipcom/oneiros";
+
+// to-do: character type annotations
+interface VListingListProps {
+ listings: ICard[];
+}
+
+type VHPNPCalendarProps = VListingListProps;
+
+export const VHPNPCalendar = ({ listings }: VHPNPCalendarProps) => {
+ const hypnosPublicContext = useContext(HypnosPublicContext);
+
+ const { authd, email, user } = useContext(AuthContext);
+
+ const globalContext = useContext(GlobalContext);
+ const { theme } = globalContext;
+
+ const [isListingsLoaded, loadListings] = ALoadPublicListings({});
+ const [, decListings] = ADecoratePublicListings({});
+ const [, unloadListings] = AUnloadPublicListings({});
+ const [, favListing] = AAddToFavoritePublicListings({});
+ const initd = useRef(false);
+
+ const { listings: currentListings }: { listings?: ICard[] } = hypnosPublicContext;
+
+ const dispatchAddToFavorites = async (cid?: number) => {
+ const func = async (payload: IDPayload) => {
+ await addToFavorites({ listings: [cid] });
+ const op_2 = await loadHypnosPublicListings();
+ loadListings({ listings: op_2 });
+ };
+ favListing({ email, cid }, func);
+ };
+
+ useEffect(() => {
+ if (authd && listings && !isListingsLoaded && !initd.current) {
+ loadListings({
+ listings: listings as ICard[],
+ });
+ initd.current = true;
+ }
+ }, [listings, isListingsLoaded, loadListings, authd]);
+
+ useEffect(() => {
+ if (authd && isListingsLoaded) {
+ decListings({ action: {} });
+
+ return () => {
+ // to-do decorate clean up
+ };
+ }
+ }, [isListingsLoaded, authd]);
+
+ useEffect(() => {
+ if (!isListingsLoaded) return;
+ return () => {
+ unloadListings();
+ };
+ }, []);
+
+ if (!authd || !listings) return;
+
+ if (!isListingsLoaded && !listings) return Loading...;
+
+ if (authd) {
+ return (
+
+
+
+ );
+ }
+
+ return ;
+};
diff --git a/src/app/components/client/elements/index.ts b/src/app/components/client/elements/index.ts
index fa9f3d2a..62e55e7c 100644
--- a/src/app/components/client/elements/index.ts
+++ b/src/app/components/client/elements/index.ts
@@ -4,6 +4,7 @@ export { VNavBar } from './navbar-view';
export { VUserSettings } from './usersettings-view';
export { VSignIn } from './signin-view';
export { VSignUp } from './signup-view';
-export { VRMList } from './rm-list-view';
export { DPLinkDec as InternalLink } from './link-decorator';
-export { VHPNPList } from './hypnos-list-view';
+export { VHPNPList } from './list-view';
+export { VHPNPCalendar } from './calendar-view';
+export { VHPNPMap } from './map-view';
diff --git a/src/app/components/client/elements/hypnos-list-view.tsx b/src/app/components/client/elements/list-view.tsx
similarity index 100%
rename from src/app/components/client/elements/hypnos-list-view.tsx
rename to src/app/components/client/elements/list-view.tsx
diff --git a/src/app/components/client/elements/map-view.tsx b/src/app/components/client/elements/map-view.tsx
new file mode 100644
index 00000000..03ffe581
--- /dev/null
+++ b/src/app/components/client/elements/map-view.tsx
@@ -0,0 +1,86 @@
+// hypnos-list-view.tsx
+'use client';
+import type { ICard } from '@dreampipcom/oneiros';
+import type { IDPayload } from '@types';
+
+import { useContext, useEffect, useRef, useMemo } from 'react';
+
+import { clsx } from 'clsx';
+import Image from 'next/image';
+import { HypnosPublicContext, AuthContext, GlobalContext } from '@state';
+import { ALoadPublicListings, AUnloadPublicListings, ADecoratePublicListings, AAddToFavoritePublicListings } from '@actions';
+import { navigate, addToFavorites, loadHypnosPublicListings } from '@gateway';
+import { CardGrid as DPCardGrid } from "@dreampipcom/oneiros";
+
+// to-do: character type annotations
+interface VListingListProps {
+ listings: ICard[];
+}
+
+type VHPNPMapProps = VListingListProps;
+
+export const VHPNPMap = ({ listings }: VHPNPMapProps) => {
+ const hypnosPublicContext = useContext(HypnosPublicContext);
+
+ const { authd, email, user } = useContext(AuthContext);
+
+ const globalContext = useContext(GlobalContext);
+ const { theme } = globalContext;
+
+ const [isListingsLoaded, loadListings] = ALoadPublicListings({});
+ const [, decListings] = ADecoratePublicListings({});
+ const [, unloadListings] = AUnloadPublicListings({});
+ const [, favListing] = AAddToFavoritePublicListings({});
+ const initd = useRef(false);
+
+ const { listings: currentListings }: { listings?: ICard[] } = hypnosPublicContext;
+
+ const dispatchAddToFavorites = async (cid?: number) => {
+ const func = async (payload: IDPayload) => {
+ await addToFavorites({ listings: [cid] });
+ const op_2 = await loadHypnosPublicListings();
+ loadListings({ listings: op_2 });
+ };
+ favListing({ email, cid }, func);
+ };
+
+ useEffect(() => {
+ if (authd && listings && !isListingsLoaded && !initd.current) {
+ loadListings({
+ listings: listings as ICard[],
+ });
+ initd.current = true;
+ }
+ }, [listings, isListingsLoaded, loadListings, authd]);
+
+ useEffect(() => {
+ if (authd && isListingsLoaded) {
+ decListings({ action: {} });
+
+ return () => {
+ // to-do decorate clean up
+ };
+ }
+ }, [isListingsLoaded, authd]);
+
+ useEffect(() => {
+ if (!isListingsLoaded) return;
+ return () => {
+ unloadListings();
+ };
+ }, []);
+
+ if (!authd || !listings) return;
+
+ if (!isListingsLoaded && !listings) return Loading...;
+
+ if (authd) {
+ return (
+
+
+
+ );
+ }
+
+ return ;
+};
diff --git a/src/app/components/client/elements/rm-list-view.tsx b/src/app/components/client/elements/rm-list-view.tsx
deleted file mode 100644
index eeeea811..00000000
--- a/src/app/components/client/elements/rm-list-view.tsx
+++ /dev/null
@@ -1,93 +0,0 @@
-// list-view.tsx
-'use client';
-import type { ICard } from '@dreampipcom/oneiros';
-import type { INCharacter, IDPayload } from '@types';
-
-import { useContext, useEffect, useRef, useMemo } from 'react';
-
-import { clsx } from 'clsx';
-import Image from 'next/image';
-import { RMContext, AuthContext, GlobalContext } from '@state';
-import { ALoadChars, AUnloadChars, ADecorateChars, AAddToFavoriteChars } from '@actions';
-import { navigate, addToFavorites, getChars } from '@gateway';
-import { CardGrid as DPCardGrid } from "@dreampipcom/oneiros";
-
-// to-do: character type annotations
-interface VCharactersListProps {
- characters: ICard[];
-}
-
-type VRMListProps = VCharactersListProps;
-
-export const VRMList = ({ characters }: VRMListProps) => {
- const rmContext = useContext(RMContext);
- const { authd, email } = useContext(AuthContext);
-
- const globalContext = useContext(GlobalContext);
- const { theme } = globalContext;
-
- const [isCharsLoaded, loadChars] = ALoadChars({});
- const [, decChars] = ADecorateChars({});
- const [, unloadChars] = AUnloadChars({});
- const [, favChar] = AAddToFavoriteChars({});
- const initd = useRef(false);
-
- const { characters: chars }: { characters?: INCharacter[] } = rmContext;
-
- const dispatchAddToFavorites = async (cid?: number) => {
- const func = async (payload: IDPayload) => {
- await addToFavorites({ listings: [cid], type: 'string' });
- const op_2 = await getChars();
- loadChars({ characters: op_2 });
- };
- favChar({ email, cid }, func);
- };
-
- useEffect(() => {
- if (authd && characters && !isCharsLoaded && !initd.current) {
- loadChars({
- characters: characters as INCharacter[],
- });
- initd.current = true;
- }
- }, [characters, isCharsLoaded, loadChars, authd]);
-
- useEffect(() => {
- if (authd && isCharsLoaded) {
- decChars({ action: {} });
-
- return () => {
- // to-do decorate clean up
- };
- }
- }, [isCharsLoaded, authd]);
-
- useEffect(() => {
- if (!isCharsLoaded) return;
- return () => {
- unloadChars();
- };
- }, []);
-
- const adaptedCharsToCards = useMemo(() => {
- const res = chars?.map((char) => ({
- ...char,
- // onLike: () => {},
- }))
- return res
- }, [chars]);
-
- if (!authd || !characters) return;
-
- if (!isCharsLoaded && !characters) return Loading...;
-
- if (authd) {
- return (
-
-
-
- );
- }
-
- return ;
-};
From b55fce398cd0b317cae687fadd73617c772874b2 Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Mon, 5 Aug 2024 17:28:18 +0100
Subject: [PATCH 02/16] ar(feat) [DPCP-38] [DPCP-39] [DPCP-46]: Abstract Views
---
src/app/components/client/elements/index.ts | 6 +-
.../components/client/elements/list-view.tsx | 57 +++++++++++--------
.../server/blocks/hypnos-public-list.tsx | 8 ++-
src/app/components/server/blocks/rm-list.tsx | 9 +--
4 files changed, 46 insertions(+), 34 deletions(-)
diff --git a/src/app/components/client/elements/index.ts b/src/app/components/client/elements/index.ts
index 62e55e7c..561ac2b3 100644
--- a/src/app/components/client/elements/index.ts
+++ b/src/app/components/client/elements/index.ts
@@ -5,6 +5,6 @@ export { VUserSettings } from './usersettings-view';
export { VSignIn } from './signin-view';
export { VSignUp } from './signup-view';
export { DPLinkDec as InternalLink } from './link-decorator';
-export { VHPNPList } from './list-view';
-export { VHPNPCalendar } from './calendar-view';
-export { VHPNPMap } from './map-view';
+export { VHPNPList as ListView } from './list-view';
+export { VHPNPCalendar as CalendarView } from './calendar-view';
+export { VHPNPMap as MapView } from './map-view';
diff --git a/src/app/components/client/elements/list-view.tsx b/src/app/components/client/elements/list-view.tsx
index 5de78dd1..87d0c3a8 100644
--- a/src/app/components/client/elements/list-view.tsx
+++ b/src/app/components/client/elements/list-view.tsx
@@ -7,72 +7,81 @@ import { useContext, useEffect, useRef, useMemo } from 'react';
import { clsx } from 'clsx';
import Image from 'next/image';
-import { HypnosPublicContext, AuthContext, GlobalContext } from '@state';
-import { ALoadPublicListings, AUnloadPublicListings, ADecoratePublicListings, AAddToFavoritePublicListings } from '@actions';
-import { navigate, addToFavorites, loadHypnosPublicListings } from '@gateway';
+import { AuthContext, GlobalContext } from '@state';
+import { navigate } from '@gateway';
import { CardGrid as DPCardGrid } from "@dreampipcom/oneiros";
// to-do: character type annotations
interface VListingListProps {
listings: ICard[];
+ addToFavorites?: () => void;
+ fetchListings?: () => void;
+ loadListings?: () => void;
+ decListings?: () => void;
+ unloadListings?: () => void;
+ listingContext?: any;
}
type VHPNPListingProps = VListingListProps;
-export const VHPNPList = ({ listings }: VHPNPListingProps) => {
- const hypnosPublicContext = useContext(HypnosPublicContext);
+export const VHPNPList = ({ listings, fetchListings, addToFavorites, loadListings, decListings, unloadListings, isListingsLoaded, listingContext }: VHPNPListingProps) => {
+ const [_isListingsLoaded, _loadListings] = loadListings({});
+ const [, _decListings] = decListings({});
+ const [, _unloadListings] = unloadListings({});
+ const [, favListing] = addToFavorites({});
+
+ const _listingContext = useContext(listingContext);
const { authd, email, user } = useContext(AuthContext);
const globalContext = useContext(GlobalContext);
const { theme } = globalContext;
- const [isListingsLoaded, loadListings] = ALoadPublicListings({});
- const [, decListings] = ADecoratePublicListings({});
- const [, unloadListings] = AUnloadPublicListings({});
- const [, favListing] = AAddToFavoritePublicListings({});
- const initd = useRef(false);
-
- const { listings: currentListings }: { listings?: ICard[] } = hypnosPublicContext;
-
const dispatchAddToFavorites = async (cid?: number) => {
const func = async (payload: IDPayload) => {
await addToFavorites({ listings: [cid] });
- const op_2 = await loadHypnosPublicListings();
- loadListings({ listings: op_2 });
+ const op_2 = await fetchListings();
+ _loadListings({ listings: op_2 });
};
favListing({ email, cid }, func);
};
+
+ const initd = useRef(false);
+
+ if (!listingContext) return;
+
+ const { listings: currentListings }: { listings?: ICard[] } = _listingContext;
+
useEffect(() => {
- if (authd && listings && !isListingsLoaded && !initd.current) {
- loadListings({
+ if (authd && listings && !_isListingsLoaded && !initd.current) {
+ _loadListings({
listings: listings as ICard[],
});
initd.current = true;
}
- }, [listings, isListingsLoaded, loadListings, authd]);
+ }, [listings, _isListingsLoaded, _loadListings, authd]);
useEffect(() => {
- if (authd && isListingsLoaded) {
- decListings({ action: {} });
+ if (authd && _isListingsLoaded) {
+ _decListings({ action: {} });
return () => {
// to-do decorate clean up
};
}
- }, [isListingsLoaded, authd]);
+ }, [_isListingsLoaded, authd]);
useEffect(() => {
- if (!isListingsLoaded) return;
+ if (!_isListingsLoaded) return;
return () => {
- unloadListings();
+ _unloadListings();
};
}, []);
if (!authd || !listings) return;
- if (!isListingsLoaded && !listings) return Loading...;
+ if (!_isListingsLoaded && !listings) return Loading...;
if (authd) {
return (
diff --git a/src/app/components/server/blocks/hypnos-public-list.tsx b/src/app/components/server/blocks/hypnos-public-list.tsx
index 7c3e68b5..97bc9fb9 100644
--- a/src/app/components/server/blocks/hypnos-public-list.tsx
+++ b/src/app/components/server/blocks/hypnos-public-list.tsx
@@ -1,16 +1,18 @@
// hypnos-public-list.tsx
'use server';
import type { ICard } from '@dreampipcom/oneiros';
-import { VHPNPList } from '@elements/client';
+import { useContext } from 'react';
+import { ListView } from '@elements/client';
import { loadHypnosPublicListings, addToFavorites } from '@gateway';
-import { HypnosPublicProvider } from '@state';
+import { HypnosPublicProvider, HypnosPublicContext } from '@state';
+import { ALoadPublicListings, AUnloadPublicListings, ADecoratePublicListings, AAddToFavoritePublicListings } from '@actions';
export const CHPNPList = async () => {
const listings: ICard[] = await loadHypnosPublicListings();
return (
-
+
);
};
diff --git a/src/app/components/server/blocks/rm-list.tsx b/src/app/components/server/blocks/rm-list.tsx
index 7665cf30..7a316017 100644
--- a/src/app/components/server/blocks/rm-list.tsx
+++ b/src/app/components/server/blocks/rm-list.tsx
@@ -1,16 +1,17 @@
// list-controller.tsx
'use server';
import type { ICard } from '@dreampipcom/oneiros';
-import { VRMList } from '@elements/client';
-import { loadChars } from '@gateway';
-import { RickMortyProvider } from '@state';
+import { ListView } from '@elements/client';
+import { loadChars, addToFavorites } from '@gateway';
+import { RickMortyProvider, RMContext } from '@state';
+import { ALoadChars, AUnloadChars, ADecorateChars, AAddToFavoriteChars} from '@actions';
export const CRMList = async () => {
const characters: ICard[] = await loadChars();
return (
-
+
);
};
From 18318b164b9f6c5dea67ed61a997a7d4df57b15e Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Mon, 5 Aug 2024 18:07:11 +0100
Subject: [PATCH 03/16] ar(feat) [DPCP-38] [DPCP-39] [DPCP-46]: Abstract Views
---
lib/model/decorators/rm-decorator.ts | 1 +
lib/state/context-rm.ts | 2 +-
.../components/client/elements/list-view.tsx | 26 ++++++++++---------
.../server/blocks/hypnos-public-list.tsx | 5 ++--
src/app/components/server/blocks/rm-list.tsx | 4 +--
5 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/lib/model/decorators/rm-decorator.ts b/lib/model/decorators/rm-decorator.ts
index 12406180..27a636e8 100644
--- a/lib/model/decorators/rm-decorator.ts
+++ b/lib/model/decorators/rm-decorator.ts
@@ -7,6 +7,7 @@ import type { INCharacter } from '@types';
/* private */
const decorateCharacter = (character: INCharacter, uMeta: any): ICard => {
const id = `list__char--${character?.name}`;
+ console.log({ character, uMeta })
const decd: ICard = {
id,
className: '',
diff --git a/lib/state/context-rm.ts b/lib/state/context-rm.ts
index 18c90f68..691c118e 100644
--- a/lib/state/context-rm.ts
+++ b/lib/state/context-rm.ts
@@ -5,7 +5,7 @@ import { createContext } from 'react';
export const RMContext = createContext({
initd: false,
- characters: [],
+ listings: [],
setter: undefined,
history: [],
});
diff --git a/src/app/components/client/elements/list-view.tsx b/src/app/components/client/elements/list-view.tsx
index 87d0c3a8..b638d87f 100644
--- a/src/app/components/client/elements/list-view.tsx
+++ b/src/app/components/client/elements/list-view.tsx
@@ -8,7 +8,7 @@ import { useContext, useEffect, useRef, useMemo } from 'react';
import { clsx } from 'clsx';
import Image from 'next/image';
import { AuthContext, GlobalContext } from '@state';
-import { navigate } from '@gateway';
+import { navigate, addToFavorites } from '@gateway';
import { CardGrid as DPCardGrid } from "@dreampipcom/oneiros";
// to-do: character type annotations
@@ -19,16 +19,17 @@ interface VListingListProps {
loadListings?: () => void;
decListings?: () => void;
unloadListings?: () => void;
+ favoriteType?: string;
listingContext?: any;
}
type VHPNPListingProps = VListingListProps;
-export const VHPNPList = ({ listings, fetchListings, addToFavorites, loadListings, decListings, unloadListings, isListingsLoaded, listingContext }: VHPNPListingProps) => {
+export const VHPNPList = ({ listings, fetchListings, favListing, loadListings, decListings, unloadListings, isListingsLoaded, listingContext, favoriteType }: VHPNPListingProps) => {
const [_isListingsLoaded, _loadListings] = loadListings({});
const [, _decListings] = decListings({});
const [, _unloadListings] = unloadListings({});
- const [, favListing] = addToFavorites({});
+ const [, _favListing] = favListing({});
const _listingContext = useContext(listingContext);
@@ -37,22 +38,23 @@ export const VHPNPList = ({ listings, fetchListings, addToFavorites, loadListing
const globalContext = useContext(GlobalContext);
const { theme } = globalContext;
+ const initd = useRef(false);
+
+ if (!listingContext) return;
+
+ const { listings: currentListings }: { listings?: ICard[] } = _listingContext;
+
+
const dispatchAddToFavorites = async (cid?: number) => {
const func = async (payload: IDPayload) => {
- await addToFavorites({ listings: [cid] });
+ const res = await addToFavorites({ listings: [cid], type: favoriteType });
+ console.log({ res })
const op_2 = await fetchListings();
_loadListings({ listings: op_2 });
};
- favListing({ email, cid }, func);
+ _favListing({ email, cid }, func);
};
-
- const initd = useRef(false);
-
- if (!listingContext) return;
-
- const { listings: currentListings }: { listings?: ICard[] } = _listingContext;
-
useEffect(() => {
if (authd && listings && !_isListingsLoaded && !initd.current) {
_loadListings({
diff --git a/src/app/components/server/blocks/hypnos-public-list.tsx b/src/app/components/server/blocks/hypnos-public-list.tsx
index 97bc9fb9..d5673a6e 100644
--- a/src/app/components/server/blocks/hypnos-public-list.tsx
+++ b/src/app/components/server/blocks/hypnos-public-list.tsx
@@ -1,9 +1,8 @@
// hypnos-public-list.tsx
'use server';
import type { ICard } from '@dreampipcom/oneiros';
-import { useContext } from 'react';
import { ListView } from '@elements/client';
-import { loadHypnosPublicListings, addToFavorites } from '@gateway';
+import { loadHypnosPublicListings } from '@gateway';
import { HypnosPublicProvider, HypnosPublicContext } from '@state';
import { ALoadPublicListings, AUnloadPublicListings, ADecoratePublicListings, AAddToFavoritePublicListings } from '@actions';
@@ -12,7 +11,7 @@ export const CHPNPList = async () => {
return (
-
+
);
};
diff --git a/src/app/components/server/blocks/rm-list.tsx b/src/app/components/server/blocks/rm-list.tsx
index 7a316017..9c9726b1 100644
--- a/src/app/components/server/blocks/rm-list.tsx
+++ b/src/app/components/server/blocks/rm-list.tsx
@@ -2,7 +2,7 @@
'use server';
import type { ICard } from '@dreampipcom/oneiros';
import { ListView } from '@elements/client';
-import { loadChars, addToFavorites } from '@gateway';
+import { loadChars, getChars } from '@gateway';
import { RickMortyProvider, RMContext } from '@state';
import { ALoadChars, AUnloadChars, ADecorateChars, AAddToFavoriteChars} from '@actions';
@@ -11,7 +11,7 @@ export const CRMList = async () => {
return (
-
+
);
};
From 12ac054e984c9651c0819fff8828cd5aa4e89f33 Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Mon, 5 Aug 2024 18:29:51 +0100
Subject: [PATCH 04/16] ar(feat) [DPCP-38] [DPCP-39] [DPCP-46]: Abstract Views
---
.../components/client/blocks/topnav-view.tsx | 4 +-
.../client/elements/calendar-view.tsx | 64 +++++++++++--------
.../components/client/elements/list-view.tsx | 1 -
.../components/client/elements/map-view.tsx | 64 +++++++++++--------
.../server/blocks/hypnos-public-list.tsx | 12 +++-
src/app/components/server/blocks/rm-list.tsx | 12 +++-
.../hypnos/{page.tsx => [[...mode]].tsx} | 6 +-
.../rickmorty/{page.tsx => [[...mode]].tsx} | 1 +
8 files changed, 99 insertions(+), 65 deletions(-)
rename src/app/services/hypnos/{page.tsx => [[...mode]].tsx} (59%)
rename src/app/services/rickmorty/{page.tsx => [[...mode]].tsx} (99%)
diff --git a/src/app/components/client/blocks/topnav-view.tsx b/src/app/components/client/blocks/topnav-view.tsx
index 715db7d6..9aebb849 100644
--- a/src/app/components/client/blocks/topnav-view.tsx
+++ b/src/app/components/client/blocks/topnav-view.tsx
@@ -66,10 +66,10 @@ export const VTopNav = ({ user }: VTopNavProps) => {
Welcome, {coercedName}
-
+
Rick Morty
-
+
hypnos
diff --git a/src/app/components/client/elements/calendar-view.tsx b/src/app/components/client/elements/calendar-view.tsx
index 54061b7c..253be61a 100644
--- a/src/app/components/client/elements/calendar-view.tsx
+++ b/src/app/components/client/elements/calendar-view.tsx
@@ -7,77 +7,87 @@ import { useContext, useEffect, useRef, useMemo } from 'react';
import { clsx } from 'clsx';
import Image from 'next/image';
-import { HypnosPublicContext, AuthContext, GlobalContext } from '@state';
-import { ALoadPublicListings, AUnloadPublicListings, ADecoratePublicListings, AAddToFavoritePublicListings } from '@actions';
-import { navigate, addToFavorites, loadHypnosPublicListings } from '@gateway';
-import { CardGrid as DPCardGrid } from "@dreampipcom/oneiros";
+import { AuthContext, GlobalContext } from '@state';
+import { navigate, addToFavorites } from '@gateway';
+import { CalendarView } from "@dreampipcom/oneiros";
// to-do: character type annotations
-interface VListingListProps {
+interface VCalendarProps {
listings: ICard[];
+ addToFavorites?: () => void;
+ fetchListings?: () => void;
+ loadListings?: () => void;
+ decListings?: () => void;
+ unloadListings?: () => void;
+ favoriteType?: string;
+ listingContext?: any;
}
-type VHPNPCalendarProps = VListingListProps;
+type VHPNPCalendarProps = VCalendarProps;
-export const VHPNPCalendar = ({ listings }: VHPNPCalendarProps) => {
- const hypnosPublicContext = useContext(HypnosPublicContext);
+export const VHPNPCalendar = ({ listings, fetchListings, favListing, loadListings, decListings, unloadListings, isListingsLoaded, listingContext, favoriteType }: VHPNPCalendarProps) => {
+ const [_isListingsLoaded, _loadListings] = loadListings({});
+ const [, _decListings] = decListings({});
+ const [, _unloadListings] = unloadListings({});
+ const [, _favListing] = favListing({});
+
+ const _listingContext = useContext(listingContext);
const { authd, email, user } = useContext(AuthContext);
const globalContext = useContext(GlobalContext);
const { theme } = globalContext;
- const [isListingsLoaded, loadListings] = ALoadPublicListings({});
- const [, decListings] = ADecoratePublicListings({});
- const [, unloadListings] = AUnloadPublicListings({});
- const [, favListing] = AAddToFavoritePublicListings({});
const initd = useRef(false);
- const { listings: currentListings }: { listings?: ICard[] } = hypnosPublicContext;
+ if (!listingContext) return;
+
+ const { listings: currentListings }: { listings?: ICard[] } = _listingContext;
+
const dispatchAddToFavorites = async (cid?: number) => {
const func = async (payload: IDPayload) => {
- await addToFavorites({ listings: [cid] });
- const op_2 = await loadHypnosPublicListings();
- loadListings({ listings: op_2 });
+ const res = await addToFavorites({ listings: [cid], type: favoriteType });
+ const op_2 = await fetchListings();
+ _loadListings({ listings: op_2 });
};
- favListing({ email, cid }, func);
+ _favListing({ email, cid }, func);
};
useEffect(() => {
- if (authd && listings && !isListingsLoaded && !initd.current) {
- loadListings({
+ if (authd && listings && !_isListingsLoaded && !initd.current) {
+ _loadListings({
listings: listings as ICard[],
});
initd.current = true;
}
- }, [listings, isListingsLoaded, loadListings, authd]);
+ }, [listings, _isListingsLoaded, _loadListings, authd]);
useEffect(() => {
- if (authd && isListingsLoaded) {
- decListings({ action: {} });
+ if (authd && _isListingsLoaded) {
+ _decListings({ action: {} });
return () => {
// to-do decorate clean up
};
}
- }, [isListingsLoaded, authd]);
+ }, [_isListingsLoaded, authd]);
useEffect(() => {
- if (!isListingsLoaded) return;
+ if (!_isListingsLoaded) return;
return () => {
- unloadListings();
+ _unloadListings();
};
}, []);
if (!authd || !listings) return;
- if (!isListingsLoaded && !listings) return Loading...;
+ if (!_isListingsLoaded && !listings) return Loading...;
if (authd) {
return (
-
+
);
}
diff --git a/src/app/components/client/elements/list-view.tsx b/src/app/components/client/elements/list-view.tsx
index b638d87f..731d22e6 100644
--- a/src/app/components/client/elements/list-view.tsx
+++ b/src/app/components/client/elements/list-view.tsx
@@ -48,7 +48,6 @@ export const VHPNPList = ({ listings, fetchListings, favListing, loadListings, d
const dispatchAddToFavorites = async (cid?: number) => {
const func = async (payload: IDPayload) => {
const res = await addToFavorites({ listings: [cid], type: favoriteType });
- console.log({ res })
const op_2 = await fetchListings();
_loadListings({ listings: op_2 });
};
diff --git a/src/app/components/client/elements/map-view.tsx b/src/app/components/client/elements/map-view.tsx
index 03ffe581..c16ffde2 100644
--- a/src/app/components/client/elements/map-view.tsx
+++ b/src/app/components/client/elements/map-view.tsx
@@ -7,77 +7,87 @@ import { useContext, useEffect, useRef, useMemo } from 'react';
import { clsx } from 'clsx';
import Image from 'next/image';
-import { HypnosPublicContext, AuthContext, GlobalContext } from '@state';
-import { ALoadPublicListings, AUnloadPublicListings, ADecoratePublicListings, AAddToFavoritePublicListings } from '@actions';
-import { navigate, addToFavorites, loadHypnosPublicListings } from '@gateway';
-import { CardGrid as DPCardGrid } from "@dreampipcom/oneiros";
+import { AuthContext, GlobalContext } from '@state';
+import { navigate, addToFavorites } from '@gateway';
+import { MapView } from "@dreampipcom/oneiros";
// to-do: character type annotations
-interface VListingListProps {
+interface VMapProps {
listings: ICard[];
+ addToFavorites?: () => void;
+ fetchListings?: () => void;
+ loadListings?: () => void;
+ decListings?: () => void;
+ unloadListings?: () => void;
+ favoriteType?: string;
+ listingContext?: any;
}
-type VHPNPMapProps = VListingListProps;
+type VHPNPMapProps = VMapProps;
-export const VHPNPMap = ({ listings }: VHPNPMapProps) => {
- const hypnosPublicContext = useContext(HypnosPublicContext);
+export const VHPNPMap = ({ listings, fetchListings, favListing, loadListings, decListings, unloadListings, isListingsLoaded, listingContext, favoriteType }: VHPNPMapProps) => {
+ const [_isListingsLoaded, _loadListings] = loadListings({});
+ const [, _decListings] = decListings({});
+ const [, _unloadListings] = unloadListings({});
+ const [, _favListing] = favListing({});
+
+ const _listingContext = useContext(listingContext);
const { authd, email, user } = useContext(AuthContext);
const globalContext = useContext(GlobalContext);
const { theme } = globalContext;
- const [isListingsLoaded, loadListings] = ALoadPublicListings({});
- const [, decListings] = ADecoratePublicListings({});
- const [, unloadListings] = AUnloadPublicListings({});
- const [, favListing] = AAddToFavoritePublicListings({});
const initd = useRef(false);
- const { listings: currentListings }: { listings?: ICard[] } = hypnosPublicContext;
+ if (!listingContext) return;
+
+ const { listings: currentListings }: { listings?: ICard[] } = _listingContext;
+
const dispatchAddToFavorites = async (cid?: number) => {
const func = async (payload: IDPayload) => {
- await addToFavorites({ listings: [cid] });
- const op_2 = await loadHypnosPublicListings();
- loadListings({ listings: op_2 });
+ const res = await addToFavorites({ listings: [cid], type: favoriteType });
+ const op_2 = await fetchListings();
+ _loadListings({ listings: op_2 });
};
- favListing({ email, cid }, func);
+ _favListing({ email, cid }, func);
};
useEffect(() => {
- if (authd && listings && !isListingsLoaded && !initd.current) {
- loadListings({
+ if (authd && listings && !_isListingsLoaded && !initd.current) {
+ _loadListings({
listings: listings as ICard[],
});
initd.current = true;
}
- }, [listings, isListingsLoaded, loadListings, authd]);
+ }, [listings, _isListingsLoaded, _loadListings, authd]);
useEffect(() => {
- if (authd && isListingsLoaded) {
- decListings({ action: {} });
+ if (authd && _isListingsLoaded) {
+ _decListings({ action: {} });
return () => {
// to-do decorate clean up
};
}
- }, [isListingsLoaded, authd]);
+ }, [_isListingsLoaded, authd]);
useEffect(() => {
- if (!isListingsLoaded) return;
+ if (!_isListingsLoaded) return;
return () => {
- unloadListings();
+ _unloadListings();
};
}, []);
if (!authd || !listings) return;
- if (!isListingsLoaded && !listings) return Loading...;
+ if (!_isListingsLoaded && !listings) return Loading...;
if (authd) {
return (
-
+
);
}
diff --git a/src/app/components/server/blocks/hypnos-public-list.tsx b/src/app/components/server/blocks/hypnos-public-list.tsx
index d5673a6e..7c53dd0a 100644
--- a/src/app/components/server/blocks/hypnos-public-list.tsx
+++ b/src/app/components/server/blocks/hypnos-public-list.tsx
@@ -1,17 +1,23 @@
// hypnos-public-list.tsx
'use server';
import type { ICard } from '@dreampipcom/oneiros';
-import { ListView } from '@elements/client';
+import { ListView, CalendarView, MapView } from '@elements/client';
import { loadHypnosPublicListings } from '@gateway';
import { HypnosPublicProvider, HypnosPublicContext } from '@state';
import { ALoadPublicListings, AUnloadPublicListings, ADecoratePublicListings, AAddToFavoritePublicListings } from '@actions';
-export const CHPNPList = async () => {
+export interface IServiceViewProps {
+ mode?: "calendar" | "list" | "map";
+}
+
+export const CHPNPList = async ({ mode = "list" }) => {
const listings: ICard[] = await loadHypnosPublicListings();
return (
-
+ {mode === "list" ? : undefined }
+ {mode === "map" ? : undefined }
+ {mode === "calendar" ? : undefined }
);
};
diff --git a/src/app/components/server/blocks/rm-list.tsx b/src/app/components/server/blocks/rm-list.tsx
index 9c9726b1..0183d138 100644
--- a/src/app/components/server/blocks/rm-list.tsx
+++ b/src/app/components/server/blocks/rm-list.tsx
@@ -1,17 +1,23 @@
// list-controller.tsx
'use server';
import type { ICard } from '@dreampipcom/oneiros';
-import { ListView } from '@elements/client';
+import { ListView, CalendarView, MapView } from '@elements/client';
import { loadChars, getChars } from '@gateway';
import { RickMortyProvider, RMContext } from '@state';
import { ALoadChars, AUnloadChars, ADecorateChars, AAddToFavoriteChars} from '@actions';
-export const CRMList = async () => {
+export interface IServiceViewProps {
+ mode?: "calendar" | "list" | "map";
+}
+
+export const CRMList = async ({ mode = "list" }: IServiceViewProps) => {
const characters: ICard[] = await loadChars();
return (
-
+ {mode === "list" ? : undefined }
+ {mode === "map" ? : undefined }
+ {mode === "calendar" ? : undefined }
);
};
diff --git a/src/app/services/hypnos/page.tsx b/src/app/services/hypnos/[[...mode]].tsx
similarity index 59%
rename from src/app/services/hypnos/page.tsx
rename to src/app/services/hypnos/[[...mode]].tsx
index 99859117..2480bb46 100644
--- a/src/app/services/hypnos/page.tsx
+++ b/src/app/services/hypnos/[[...mode]].tsx
@@ -1,10 +1,12 @@
// page.tsx
import { DPPublicListings } from '@blocks/server';
-export default function Home() {
+
+export default function Home({ mode = 'list' }) {
+
return (
);
diff --git a/src/app/services/rickmorty/page.tsx b/src/app/services/rickmorty/[[...mode]].tsx
similarity index 99%
rename from src/app/services/rickmorty/page.tsx
rename to src/app/services/rickmorty/[[...mode]].tsx
index c3f973ad..fa6c22ba 100644
--- a/src/app/services/rickmorty/page.tsx
+++ b/src/app/services/rickmorty/[[...mode]].tsx
@@ -1,5 +1,6 @@
// page.tsx
import { DPRMList } from '@blocks/server';
+
export default function Home() {
return (
From b5e3a274740cd27d1f230c2c53dd240366ff8ecd Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Mon, 5 Aug 2024 18:52:02 +0100
Subject: [PATCH 05/16] ar(feat) [DPCP-38] [DPCP-39] [DPCP-46]: Abstract Views
---
next.config.js | 13 ++++++++++++-
src/app/components/client/blocks/topnav-view.tsx | 7 +++++--
.../hypnos/{[[...mode]].tsx => [mode]/page.tsx} | 4 ++--
.../rickmorty/{[[...mode]].tsx => [mode]/page.tsx} | 3 ++-
4 files changed, 21 insertions(+), 6 deletions(-)
rename src/app/services/hypnos/{[[...mode]].tsx => [mode]/page.tsx} (68%)
rename src/app/services/rickmorty/{[[...mode]].tsx => [mode]/page.tsx} (65%)
diff --git a/next.config.js b/next.config.js
index 070b88d8..925d1334 100644
--- a/next.config.js
+++ b/next.config.js
@@ -12,7 +12,18 @@ const nextConfig = {
],
},
async redirects() {
- return [];
+ return [
+ {
+ source: '/services/hypnos',
+ destination: '/services/hypnos/list',
+ permanent: false
+ },
+ {
+ source: '/services/rickmorty',
+ destination: '/services/rickmorty/list',
+ permanent: false
+ }
+ ];
},
};
diff --git a/src/app/components/client/blocks/topnav-view.tsx b/src/app/components/client/blocks/topnav-view.tsx
index 9aebb849..2949e348 100644
--- a/src/app/components/client/blocks/topnav-view.tsx
+++ b/src/app/components/client/blocks/topnav-view.tsx
@@ -73,10 +73,13 @@ export const VTopNav = ({ user }: VTopNavProps) => {
hypnos
-
-
+
+
+
navigate(document.location.href.replace(/(map|calendar)/, 'list'))} />
+ navigate(document.location.href.replace(/(list|calendar)/, 'map'))} />
+ navigate(document.location.href.replace(/(list|map)/, 'calendar'))} />
diff --git a/src/app/services/hypnos/[[...mode]].tsx b/src/app/services/hypnos/[mode]/page.tsx
similarity index 68%
rename from src/app/services/hypnos/[[...mode]].tsx
rename to src/app/services/hypnos/[mode]/page.tsx
index 2480bb46..c1b93e45 100644
--- a/src/app/services/hypnos/[[...mode]].tsx
+++ b/src/app/services/hypnos/[mode]/page.tsx
@@ -1,8 +1,8 @@
// page.tsx
import { DPPublicListings } from '@blocks/server';
-export default function Home({ mode = 'list' }) {
-
+export default function Home({ params }) {
+ const mode = params.mode || "list"
return (
diff --git a/src/app/services/rickmorty/[[...mode]].tsx b/src/app/services/rickmorty/[mode]/page.tsx
similarity index 65%
rename from src/app/services/rickmorty/[[...mode]].tsx
rename to src/app/services/rickmorty/[mode]/page.tsx
index fa6c22ba..788349de 100644
--- a/src/app/services/rickmorty/[[...mode]].tsx
+++ b/src/app/services/rickmorty/[mode]/page.tsx
@@ -1,7 +1,8 @@
// page.tsx
import { DPRMList } from '@blocks/server';
-export default function Home() {
+export default function Home({ params }) {
+ const mode = params.mode || "list"
return (
From 41033f7f8e4e699cdf99216b5ec3b3a34ee65f06 Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Mon, 5 Aug 2024 18:54:45 +0100
Subject: [PATCH 06/16] ar(feat) [DPCP-38] [DPCP-39] [DPCP-46]: Abstract Views
---
lib/model/decorators/rm-decorator.ts | 2 +-
next.config.js | 14 +++++++-------
src/app/services/hypnos/[mode]/page.tsx | 2 +-
src/app/services/rickmorty/[mode]/page.tsx | 4 ++--
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/lib/model/decorators/rm-decorator.ts b/lib/model/decorators/rm-decorator.ts
index 27a636e8..f99c5487 100644
--- a/lib/model/decorators/rm-decorator.ts
+++ b/lib/model/decorators/rm-decorator.ts
@@ -7,7 +7,7 @@ import type { INCharacter } from '@types';
/* private */
const decorateCharacter = (character: INCharacter, uMeta: any): ICard => {
const id = `list__char--${character?.name}`;
- console.log({ character, uMeta })
+ console.log({ character, uMeta });
const decd: ICard = {
id,
className: '',
diff --git a/next.config.js b/next.config.js
index 925d1334..aa4efa83 100644
--- a/next.config.js
+++ b/next.config.js
@@ -14,15 +14,15 @@ const nextConfig = {
async redirects() {
return [
{
- source: '/services/hypnos',
- destination: '/services/hypnos/list',
- permanent: false
+ source: '/services/hypnos',
+ destination: '/services/hypnos/list',
+ permanent: false,
},
{
- source: '/services/rickmorty',
- destination: '/services/rickmorty/list',
- permanent: false
- }
+ source: '/services/rickmorty',
+ destination: '/services/rickmorty/list',
+ permanent: false,
+ },
];
},
};
diff --git a/src/app/services/hypnos/[mode]/page.tsx b/src/app/services/hypnos/[mode]/page.tsx
index c1b93e45..501d2d41 100644
--- a/src/app/services/hypnos/[mode]/page.tsx
+++ b/src/app/services/hypnos/[mode]/page.tsx
@@ -2,7 +2,7 @@
import { DPPublicListings } from '@blocks/server';
export default function Home({ params }) {
- const mode = params.mode || "list"
+ const mode = params.mode || 'list';
return (
diff --git a/src/app/services/rickmorty/[mode]/page.tsx b/src/app/services/rickmorty/[mode]/page.tsx
index 788349de..ddfb26b8 100644
--- a/src/app/services/rickmorty/[mode]/page.tsx
+++ b/src/app/services/rickmorty/[mode]/page.tsx
@@ -2,11 +2,11 @@
import { DPRMList } from '@blocks/server';
export default function Home({ params }) {
- const mode = params.mode || "list"
+ const mode = params.mode || 'list';
return (
);
From c13d1be922fd7d6fd81d747e7074001b5f8e98ed Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Mon, 5 Aug 2024 18:58:34 +0100
Subject: [PATCH 07/16] ar(feat) [DPCP-38] [DPCP-39] [DPCP-46]: Abstract Views
---
lib/types/contexts.d.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/types/contexts.d.ts b/lib/types/contexts.d.ts
index f018950a..451385f8 100644
--- a/lib/types/contexts.d.ts
+++ b/lib/types/contexts.d.ts
@@ -42,7 +42,7 @@ export interface IGlobalContext extends History {
// to-do: characters type annotations
export interface IRMContext extends History {
initd?: boolean;
- characters?: INCharacter[];
+ listings?: INCharacter[];
}
export interface IHypnosPublicContext extends History {
From c087c294fa5e053edce7b152c22ab4e67dbb472b Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Mon, 5 Aug 2024 19:00:46 +0100
Subject: [PATCH 08/16] ar(feat) [DPCP-38] [DPCP-39] [DPCP-46]: Abstract Views
---
src/app/components/client/elements/calendar-view.tsx | 2 +-
src/app/components/client/elements/list-view.tsx | 2 +-
src/app/components/client/elements/map-view.tsx | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/app/components/client/elements/calendar-view.tsx b/src/app/components/client/elements/calendar-view.tsx
index 253be61a..197f8611 100644
--- a/src/app/components/client/elements/calendar-view.tsx
+++ b/src/app/components/client/elements/calendar-view.tsx
@@ -14,7 +14,7 @@ import { CalendarView } from "@dreampipcom/oneiros";
// to-do: character type annotations
interface VCalendarProps {
listings: ICard[];
- addToFavorites?: () => void;
+ favListing?: () => void;
fetchListings?: () => void;
loadListings?: () => void;
decListings?: () => void;
diff --git a/src/app/components/client/elements/list-view.tsx b/src/app/components/client/elements/list-view.tsx
index 731d22e6..083cc09e 100644
--- a/src/app/components/client/elements/list-view.tsx
+++ b/src/app/components/client/elements/list-view.tsx
@@ -14,7 +14,7 @@ import { CardGrid as DPCardGrid } from "@dreampipcom/oneiros";
// to-do: character type annotations
interface VListingListProps {
listings: ICard[];
- addToFavorites?: () => void;
+ favListing?: () => void;
fetchListings?: () => void;
loadListings?: () => void;
decListings?: () => void;
diff --git a/src/app/components/client/elements/map-view.tsx b/src/app/components/client/elements/map-view.tsx
index c16ffde2..55ecd629 100644
--- a/src/app/components/client/elements/map-view.tsx
+++ b/src/app/components/client/elements/map-view.tsx
@@ -14,7 +14,7 @@ import { MapView } from "@dreampipcom/oneiros";
// to-do: character type annotations
interface VMapProps {
listings: ICard[];
- addToFavorites?: () => void;
+ favListing?: () => void;
fetchListings?: () => void;
loadListings?: () => void;
decListings?: () => void;
From 97cc659086d6edea5fafc00ef93a217f2f3235dd Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Mon, 5 Aug 2024 19:02:14 +0100
Subject: [PATCH 09/16] ar(feat) [DPCP-38] [DPCP-39] [DPCP-46]: Abstract Views
---
src/app/components/client/elements/calendar-view.tsx | 2 +-
src/app/components/client/elements/list-view.tsx | 2 +-
src/app/components/client/elements/map-view.tsx | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/app/components/client/elements/calendar-view.tsx b/src/app/components/client/elements/calendar-view.tsx
index 197f8611..6ed921f8 100644
--- a/src/app/components/client/elements/calendar-view.tsx
+++ b/src/app/components/client/elements/calendar-view.tsx
@@ -25,7 +25,7 @@ interface VCalendarProps {
type VHPNPCalendarProps = VCalendarProps;
-export const VHPNPCalendar = ({ listings, fetchListings, favListing, loadListings, decListings, unloadListings, isListingsLoaded, listingContext, favoriteType }: VHPNPCalendarProps) => {
+export const VHPNPCalendar = ({ listings, fetchListings, favListing, loadListings, decListings, unloadListings, listingContext, favoriteType }: VHPNPCalendarProps) => {
const [_isListingsLoaded, _loadListings] = loadListings({});
const [, _decListings] = decListings({});
const [, _unloadListings] = unloadListings({});
diff --git a/src/app/components/client/elements/list-view.tsx b/src/app/components/client/elements/list-view.tsx
index 083cc09e..2f1f1aa0 100644
--- a/src/app/components/client/elements/list-view.tsx
+++ b/src/app/components/client/elements/list-view.tsx
@@ -25,7 +25,7 @@ interface VListingListProps {
type VHPNPListingProps = VListingListProps;
-export const VHPNPList = ({ listings, fetchListings, favListing, loadListings, decListings, unloadListings, isListingsLoaded, listingContext, favoriteType }: VHPNPListingProps) => {
+export const VHPNPList = ({ listings, fetchListings, favListing, loadListings, decListings, unloadListings, listingContext, favoriteType }: VHPNPListingProps) => {
const [_isListingsLoaded, _loadListings] = loadListings({});
const [, _decListings] = decListings({});
const [, _unloadListings] = unloadListings({});
diff --git a/src/app/components/client/elements/map-view.tsx b/src/app/components/client/elements/map-view.tsx
index 55ecd629..f8c6d8de 100644
--- a/src/app/components/client/elements/map-view.tsx
+++ b/src/app/components/client/elements/map-view.tsx
@@ -25,7 +25,7 @@ interface VMapProps {
type VHPNPMapProps = VMapProps;
-export const VHPNPMap = ({ listings, fetchListings, favListing, loadListings, decListings, unloadListings, isListingsLoaded, listingContext, favoriteType }: VHPNPMapProps) => {
+export const VHPNPMap = ({ listings, fetchListings, favListing, loadListings, decListings, unloadListings, listingContext, favoriteType }: VHPNPMapProps) => {
const [_isListingsLoaded, _loadListings] = loadListings({});
const [, _decListings] = decListings({});
const [, _unloadListings] = unloadListings({});
From 2e7095a8a103dd003cc91ff75da4a57c1da231ea Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Mon, 5 Aug 2024 19:05:19 +0100
Subject: [PATCH 10/16] ar(feat) [DPCP-38] [DPCP-39] [DPCP-46]: Abstract Views
---
src/app/components/client/elements/calendar-view.tsx | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/app/components/client/elements/calendar-view.tsx b/src/app/components/client/elements/calendar-view.tsx
index 6ed921f8..4ed88fbd 100644
--- a/src/app/components/client/elements/calendar-view.tsx
+++ b/src/app/components/client/elements/calendar-view.tsx
@@ -14,11 +14,11 @@ import { CalendarView } from "@dreampipcom/oneiros";
// to-do: character type annotations
interface VCalendarProps {
listings: ICard[];
- favListing?: () => void;
- fetchListings?: () => void;
- loadListings?: () => void;
- decListings?: () => void;
- unloadListings?: () => void;
+ favListing?: (conf?: any) => void;
+ fetchListings?: (conf?: any) => void;
+ loadListings?: (conf?: any) => void;
+ decListings?: (conf?: any) => void;
+ unloadListings?: (conf?: any) => void;
favoriteType?: string;
listingContext?: any;
}
From 079674afe63661cc4ce435db8813de0c2541a751 Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Mon, 5 Aug 2024 19:05:46 +0100
Subject: [PATCH 11/16] ar(feat) [DPCP-38] [DPCP-39] [DPCP-46]: Abstract Views
---
src/app/components/client/elements/calendar-view.tsx | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/app/components/client/elements/calendar-view.tsx b/src/app/components/client/elements/calendar-view.tsx
index 4ed88fbd..3fd0477c 100644
--- a/src/app/components/client/elements/calendar-view.tsx
+++ b/src/app/components/client/elements/calendar-view.tsx
@@ -14,11 +14,11 @@ import { CalendarView } from "@dreampipcom/oneiros";
// to-do: character type annotations
interface VCalendarProps {
listings: ICard[];
- favListing?: (conf?: any) => void;
- fetchListings?: (conf?: any) => void;
- loadListings?: (conf?: any) => void;
- decListings?: (conf?: any) => void;
- unloadListings?: (conf?: any) => void;
+ favListing?: (conf?: any) => any;
+ fetchListings?: (conf?: any) => any;
+ loadListings?: (conf?: any) => any;
+ decListings?: (conf?: any) => any;
+ unloadListings?: (conf?: any) => any;
favoriteType?: string;
listingContext?: any;
}
From d0bc16a6e8aaf3ae2d9b1ed128274e0243b2ca9e Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Mon, 5 Aug 2024 19:09:00 +0100
Subject: [PATCH 12/16] ar(feat) [DPCP-38] [DPCP-39] [DPCP-46]: Abstract Views
---
src/app/components/client/elements/list-view.tsx | 14 +++++++-------
src/app/components/client/elements/map-view.tsx | 14 +++++++-------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/app/components/client/elements/list-view.tsx b/src/app/components/client/elements/list-view.tsx
index 2f1f1aa0..295e8544 100644
--- a/src/app/components/client/elements/list-view.tsx
+++ b/src/app/components/client/elements/list-view.tsx
@@ -12,15 +12,15 @@ import { navigate, addToFavorites } from '@gateway';
import { CardGrid as DPCardGrid } from "@dreampipcom/oneiros";
// to-do: character type annotations
-interface VListingListProps {
+interface VCalendarProps {
listings: ICard[];
- favListing?: () => void;
- fetchListings?: () => void;
- loadListings?: () => void;
- decListings?: () => void;
- unloadListings?: () => void;
+ favListing: (conf?: any) => any;
+ fetchListings: (conf?: any) => any;
+ loadListings: (conf?: any) => any;
+ decListings: (conf?: any) => any;
+ unloadListings: (conf?: any) => any;
favoriteType?: string;
- listingContext?: any;
+ listingContext: any;
}
type VHPNPListingProps = VListingListProps;
diff --git a/src/app/components/client/elements/map-view.tsx b/src/app/components/client/elements/map-view.tsx
index f8c6d8de..24a1adae 100644
--- a/src/app/components/client/elements/map-view.tsx
+++ b/src/app/components/client/elements/map-view.tsx
@@ -12,15 +12,15 @@ import { navigate, addToFavorites } from '@gateway';
import { MapView } from "@dreampipcom/oneiros";
// to-do: character type annotations
-interface VMapProps {
+interface VCalendarProps {
listings: ICard[];
- favListing?: () => void;
- fetchListings?: () => void;
- loadListings?: () => void;
- decListings?: () => void;
- unloadListings?: () => void;
+ favListing: (conf?: any) => any;
+ fetchListings: (conf?: any) => any;
+ loadListings: (conf?: any) => any;
+ decListings: (conf?: any) => any;
+ unloadListings: (conf?: any) => any;
favoriteType?: string;
- listingContext?: any;
+ listingContext: any;
}
type VHPNPMapProps = VMapProps;
From f5241f8c69120d2a40309bcbf5748365eabebc8c Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Mon, 5 Aug 2024 19:13:52 +0100
Subject: [PATCH 13/16] ar(feat) [DPCP-38] [DPCP-39] [DPCP-46]: Abstract Views
---
.env.public | 1 +
.../components/client/elements/calendar-view.tsx | 15 ++++++++-------
src/app/components/client/elements/list-view.tsx | 1 +
src/app/components/client/elements/map-view.tsx | 1 +
4 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/.env.public b/.env.public
index 98be9269..b617290b 100644
--- a/.env.public
+++ b/.env.public
@@ -55,6 +55,7 @@ NEXT_PUBLIC_NEXUS_BASE_PATH=
NEXT_PUBLIC_NEXUS_NAME=Nexus
NEXT_PUBLIC_NEXUS_LOGO_PATH=
NEXT_PUBLIC_NEXUS_DEFAULT_IMAGE_PATH=
+NEXT_PUBLIC_MAPBOX_TOKEN=
# config
ENABLE_LOG=true
diff --git a/src/app/components/client/elements/calendar-view.tsx b/src/app/components/client/elements/calendar-view.tsx
index 3fd0477c..10451d17 100644
--- a/src/app/components/client/elements/calendar-view.tsx
+++ b/src/app/components/client/elements/calendar-view.tsx
@@ -1,4 +1,5 @@
// hypnos-list-view.tsx
+// @ts-nocheck
'use client';
import type { ICard } from '@dreampipcom/oneiros';
import type { IDPayload } from '@types';
@@ -14,18 +15,18 @@ import { CalendarView } from "@dreampipcom/oneiros";
// to-do: character type annotations
interface VCalendarProps {
listings: ICard[];
- favListing?: (conf?: any) => any;
- fetchListings?: (conf?: any) => any;
- loadListings?: (conf?: any) => any;
- decListings?: (conf?: any) => any;
- unloadListings?: (conf?: any) => any;
+ favListing: (conf?: any) => any;
+ fetchListings: (conf?: any) => any;
+ loadListings: (conf?: any) => any;
+ decListings: (conf?: any) => any;
+ unloadListings: (conf?: any) => any;
favoriteType?: string;
- listingContext?: any;
+ listingContext: any;
}
type VHPNPCalendarProps = VCalendarProps;
-export const VHPNPCalendar = ({ listings, fetchListings, favListing, loadListings, decListings, unloadListings, listingContext, favoriteType }: VHPNPCalendarProps) => {
+export const VHPNPCalendar = ({ listings = () => {}, fetchListings = () => {}, favListing = () => {}, loadListings = () => {}, decListings = () => {}, unloadListings = () => {}, listingContext = {}, favoriteType }: VHPNPCalendarProps) => {
const [_isListingsLoaded, _loadListings] = loadListings({});
const [, _decListings] = decListings({});
const [, _unloadListings] = unloadListings({});
diff --git a/src/app/components/client/elements/list-view.tsx b/src/app/components/client/elements/list-view.tsx
index 295e8544..99133c87 100644
--- a/src/app/components/client/elements/list-view.tsx
+++ b/src/app/components/client/elements/list-view.tsx
@@ -1,4 +1,5 @@
// hypnos-list-view.tsx
+// @ts-nocheck
'use client';
import type { ICard } from '@dreampipcom/oneiros';
import type { IDPayload } from '@types';
diff --git a/src/app/components/client/elements/map-view.tsx b/src/app/components/client/elements/map-view.tsx
index 24a1adae..e2436b48 100644
--- a/src/app/components/client/elements/map-view.tsx
+++ b/src/app/components/client/elements/map-view.tsx
@@ -1,4 +1,5 @@
// hypnos-list-view.tsx
+// @ts-ignore
'use client';
import type { ICard } from '@dreampipcom/oneiros';
import type { IDPayload } from '@types';
From 9d691efe696e8446870596915fe1d2ee91c30ba7 Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Mon, 5 Aug 2024 19:15:05 +0100
Subject: [PATCH 14/16] ar(feat) [DPCP-38] [DPCP-39] [DPCP-46]: Abstract Views
---
src/app/components/client/elements/map-view.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/app/components/client/elements/map-view.tsx b/src/app/components/client/elements/map-view.tsx
index e2436b48..c4e3c8b6 100644
--- a/src/app/components/client/elements/map-view.tsx
+++ b/src/app/components/client/elements/map-view.tsx
@@ -1,5 +1,5 @@
// hypnos-list-view.tsx
-// @ts-ignore
+// @ts-nocheck
'use client';
import type { ICard } from '@dreampipcom/oneiros';
import type { IDPayload } from '@types';
@@ -13,7 +13,7 @@ import { navigate, addToFavorites } from '@gateway';
import { MapView } from "@dreampipcom/oneiros";
// to-do: character type annotations
-interface VCalendarProps {
+interface VMapProps {
listings: ICard[];
favListing: (conf?: any) => any;
fetchListings: (conf?: any) => any;
From c88ba41d79ab490b73202ead8c40ff508084d622 Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Mon, 5 Aug 2024 19:16:42 +0100
Subject: [PATCH 15/16] ar(feat) [DPCP-38] [DPCP-39] [DPCP-46]: Abstract Views
---
src/app/services/hypnos/[mode]/page.tsx | 4 ++--
src/app/services/rickmorty/[mode]/page.tsx | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/app/services/hypnos/[mode]/page.tsx b/src/app/services/hypnos/[mode]/page.tsx
index 501d2d41..47679737 100644
--- a/src/app/services/hypnos/[mode]/page.tsx
+++ b/src/app/services/hypnos/[mode]/page.tsx
@@ -1,8 +1,8 @@
// page.tsx
import { DPPublicListings } from '@blocks/server';
-export default function Home({ params }) {
- const mode = params.mode || 'list';
+export default function Home({ params }: any) {
+ const mode = params?.mode || 'list';
return (
diff --git a/src/app/services/rickmorty/[mode]/page.tsx b/src/app/services/rickmorty/[mode]/page.tsx
index ddfb26b8..a6b213d7 100644
--- a/src/app/services/rickmorty/[mode]/page.tsx
+++ b/src/app/services/rickmorty/[mode]/page.tsx
@@ -1,8 +1,8 @@
// page.tsx
import { DPRMList } from '@blocks/server';
-export default function Home({ params }) {
- const mode = params.mode || 'list';
+export default function Home({ params }: any) {
+ const mode = params?.mode || 'list';
return (
From 9e19f138bb50a902c1eba7375260df46f5a84982 Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Mon, 5 Aug 2024 19:19:28 +0100
Subject: [PATCH 16/16] ar(feat) [DPCP-38] [DPCP-39] [DPCP-46]: Abstract Views
---
lib/model/decorators/rm-decorator.ts | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/model/decorators/rm-decorator.ts b/lib/model/decorators/rm-decorator.ts
index f99c5487..12406180 100644
--- a/lib/model/decorators/rm-decorator.ts
+++ b/lib/model/decorators/rm-decorator.ts
@@ -7,7 +7,6 @@ import type { INCharacter } from '@types';
/* private */
const decorateCharacter = (character: INCharacter, uMeta: any): ICard => {
const id = `list__char--${character?.name}`;
- console.log({ character, uMeta });
const decd: ICard = {
id,
className: '',