@replyke/core 7.0.0-beta.11 → 7.0.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/hooks/comments/useFetchManyComments.d.ts +2 -2
- package/dist/cjs/hooks/comments/useFetchManyComments.js +5 -7
- package/dist/cjs/hooks/comments/useFetchManyComments.js.map +1 -1
- package/dist/cjs/hooks/comments/useProfileComments.d.ts +2 -2
- package/dist/cjs/hooks/comments/useProfileComments.js +8 -8
- package/dist/cjs/hooks/comments/useProfileComments.js.map +1 -1
- package/dist/cjs/hooks/entities/index.d.ts +1 -0
- package/dist/cjs/hooks/entities/index.js +3 -1
- package/dist/cjs/hooks/entities/index.js.map +1 -1
- package/dist/cjs/hooks/entities/useProfileEntities.d.ts +28 -0
- package/dist/cjs/hooks/entities/useProfileEntities.js +213 -0
- package/dist/cjs/hooks/entities/useProfileEntities.js.map +1 -0
- package/dist/cjs/interfaces/models/Comment.d.ts +3 -0
- package/dist/esm/hooks/comments/useFetchManyComments.d.ts +2 -2
- package/dist/esm/hooks/comments/useFetchManyComments.js +5 -7
- package/dist/esm/hooks/comments/useFetchManyComments.js.map +1 -1
- package/dist/esm/hooks/comments/useProfileComments.d.ts +2 -2
- package/dist/esm/hooks/comments/useProfileComments.js +8 -8
- package/dist/esm/hooks/comments/useProfileComments.js.map +1 -1
- package/dist/esm/hooks/entities/index.d.ts +1 -0
- package/dist/esm/hooks/entities/index.js +1 -0
- package/dist/esm/hooks/entities/index.js.map +1 -1
- package/dist/esm/hooks/entities/useProfileEntities.d.ts +28 -0
- package/dist/esm/hooks/entities/useProfileEntities.js +208 -0
- package/dist/esm/hooks/entities/useProfileEntities.js.map +1 -0
- package/dist/esm/interfaces/models/Comment.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommentsSortByOptions } from "../../interfaces/CommentsSortByOptions";
|
|
2
|
-
import { Comment } from "../../interfaces/models/Comment";
|
|
2
|
+
import { Comment, CommentIncludeParam } from "../../interfaces/models/Comment";
|
|
3
3
|
import { PaginatedResponse } from "../../interfaces/IPaginatedResponse";
|
|
4
4
|
declare function useFetchManyComments(): (props: {
|
|
5
5
|
entityId?: string | null | undefined;
|
|
@@ -8,7 +8,7 @@ declare function useFetchManyComments(): (props: {
|
|
|
8
8
|
sortBy?: CommentsSortByOptions;
|
|
9
9
|
page: number;
|
|
10
10
|
limit?: number;
|
|
11
|
-
|
|
11
|
+
include?: CommentIncludeParam;
|
|
12
12
|
sourceId?: string | null | undefined;
|
|
13
13
|
}) => Promise<PaginatedResponse<Comment>>;
|
|
14
14
|
export default useFetchManyComments;
|
|
@@ -46,20 +46,17 @@ function useFetchManyComments() {
|
|
|
46
46
|
var _this = this;
|
|
47
47
|
var projectId = (0, useProject_1.default)().projectId;
|
|
48
48
|
var fetchComments = (0, react_1.useCallback)(function (props) { return __awaiter(_this, void 0, void 0, function () {
|
|
49
|
-
var entityId, userId, parentId, sortBy, page, limit,
|
|
49
|
+
var entityId, userId, parentId, sortBy, page, limit, include, sourceId, params, response;
|
|
50
50
|
return __generator(this, function (_a) {
|
|
51
51
|
switch (_a.label) {
|
|
52
52
|
case 0:
|
|
53
|
-
entityId = props.entityId, userId = props.userId, parentId = props.parentId, sortBy = props.sortBy, page = props.page, limit = props.limit,
|
|
53
|
+
entityId = props.entityId, userId = props.userId, parentId = props.parentId, sortBy = props.sortBy, page = props.page, limit = props.limit, include = props.include, sourceId = props.sourceId;
|
|
54
54
|
if (page === 0) {
|
|
55
55
|
throw new Error("Can't fetch comments with page 0");
|
|
56
56
|
}
|
|
57
57
|
if (limit === 0) {
|
|
58
58
|
throw new Error("Can't fetch with limit 0");
|
|
59
59
|
}
|
|
60
|
-
if (!sortBy) {
|
|
61
|
-
throw new Error("Can't fetch without sortBy property");
|
|
62
|
-
}
|
|
63
60
|
if (!projectId) {
|
|
64
61
|
throw new Error("No project specified");
|
|
65
62
|
}
|
|
@@ -74,10 +71,11 @@ function useFetchManyComments() {
|
|
|
74
71
|
params.userId = userId;
|
|
75
72
|
if (parentId)
|
|
76
73
|
params.parentId = parentId;
|
|
77
|
-
if (includeEntity)
|
|
78
|
-
params.includeEntity = includeEntity;
|
|
79
74
|
if (sourceId)
|
|
80
75
|
params.sourceId = sourceId;
|
|
76
|
+
if (include) {
|
|
77
|
+
params.include = Array.isArray(include) ? include.join(',') : include;
|
|
78
|
+
}
|
|
81
79
|
return [4 /*yield*/, axios_1.default.get("/".concat(projectId, "/comments"), {
|
|
82
80
|
params: params,
|
|
83
81
|
})];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchManyComments.js","sourceRoot":"","sources":["../../../../src/hooks/comments/useFetchManyComments.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAoC;AAIpC,sEAAgD;AAChD,6DAAuC;AAEvC,SAAS,oBAAoB;IAA7B,
|
|
1
|
+
{"version":3,"file":"useFetchManyComments.js","sourceRoot":"","sources":["../../../../src/hooks/comments/useFetchManyComments.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAoC;AAIpC,sEAAgD;AAChD,6DAAuC;AAEvC,SAAS,oBAAoB;IAA7B,iBAgEC;IA/DS,IAAA,SAAS,GAAK,IAAA,oBAAU,GAAE,UAAjB,CAAkB;IAEnC,IAAM,aAAa,GAAG,IAAA,mBAAW,EAC/B,UAAO,KASN;;;;;oBAEG,QAAQ,GAQN,KAAK,SARC,EACR,MAAM,GAOJ,KAAK,OAPD,EACN,QAAQ,GAMN,KAAK,SANC,EACR,MAAM,GAKJ,KAAK,OALD,EACN,IAAI,GAIF,KAAK,KAJH,EACJ,KAAK,GAGH,KAAK,MAHF,EACL,OAAO,GAEL,KAAK,QAFA,EACP,QAAQ,GACN,KAAK,SADC,CACA;oBAEV,IAAI,IAAI,KAAK,CAAC,EA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+
import { Comment, CommentIncludeParam } from "../../interfaces/models/Comment";
|
|
3
3
|
export interface UseProfileCommentsProps {
|
|
4
4
|
userId: string | undefined | null;
|
|
5
5
|
limit?: number;
|
|
6
6
|
defaultSortBy?: CommentsSortByOptions;
|
|
7
|
-
|
|
7
|
+
include?: CommentIncludeParam;
|
|
8
8
|
}
|
|
9
9
|
export interface UseProfileCommentsValues {
|
|
10
10
|
comments: Comment[];
|
|
@@ -53,7 +53,7 @@ var useFetchManyComments_1 = __importDefault(require("./useFetchManyComments"));
|
|
|
53
53
|
var handleError_1 = require("../../utils/handleError");
|
|
54
54
|
function useProfileComments(props) {
|
|
55
55
|
var _this = this;
|
|
56
|
-
var userId = props.userId, _a = props.limit, limit = _a === void 0 ? 10 : _a, _b = props.defaultSortBy, defaultSortBy = _b === void 0 ? "new" : _b,
|
|
56
|
+
var userId = props.userId, _a = props.limit, limit = _a === void 0 ? 10 : _a, _b = props.defaultSortBy, defaultSortBy = _b === void 0 ? "new" : _b, include = props.include;
|
|
57
57
|
var fetchManyComments = (0, useFetchManyComments_1.default)();
|
|
58
58
|
var loading = (0, react_1.useRef)(true);
|
|
59
59
|
var _c = (0, react_1.useState)(true), loadingState = _c[0], setLoadingState = _c[1]; // required to trigger rerenders
|
|
@@ -85,8 +85,8 @@ function useProfileComments(props) {
|
|
|
85
85
|
userId: userId,
|
|
86
86
|
page: 1,
|
|
87
87
|
sortBy: sortBy,
|
|
88
|
-
limit:
|
|
89
|
-
|
|
88
|
+
limit: limit,
|
|
89
|
+
include: include,
|
|
90
90
|
})];
|
|
91
91
|
case 2:
|
|
92
92
|
response = _a.sent();
|
|
@@ -108,7 +108,7 @@ function useProfileComments(props) {
|
|
|
108
108
|
case 5: return [2 /*return*/];
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
|
-
}); }, [fetchManyComments, limit, sortBy, userId,
|
|
111
|
+
}); }, [fetchManyComments, limit, sortBy, userId, include]);
|
|
112
112
|
var loadMore = function () {
|
|
113
113
|
if (loading.current || !hasMore.current)
|
|
114
114
|
return;
|
|
@@ -119,7 +119,7 @@ function useProfileComments(props) {
|
|
|
119
119
|
(0, react_1.useEffect)(function () {
|
|
120
120
|
resetComments();
|
|
121
121
|
}, [resetComments]);
|
|
122
|
-
// useEffect to get a new batch of
|
|
122
|
+
// useEffect to get a new batch of comments
|
|
123
123
|
(0, react_1.useEffect)(function () {
|
|
124
124
|
var loadMoreComments = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
125
125
|
var response, newComments_1, pagination, err_2;
|
|
@@ -136,7 +136,7 @@ function useProfileComments(props) {
|
|
|
136
136
|
page: page,
|
|
137
137
|
sortBy: sortBy,
|
|
138
138
|
limit: limit,
|
|
139
|
-
|
|
139
|
+
include: include,
|
|
140
140
|
})];
|
|
141
141
|
case 2:
|
|
142
142
|
response = _a.sent();
|
|
@@ -159,11 +159,11 @@ function useProfileComments(props) {
|
|
|
159
159
|
}
|
|
160
160
|
});
|
|
161
161
|
}); };
|
|
162
|
-
// We only load more if
|
|
162
|
+
// We only load more if the page changed
|
|
163
163
|
if (page > 1 && hasMore.current && !loading.current) {
|
|
164
164
|
loadMoreComments();
|
|
165
165
|
}
|
|
166
|
-
}, [page]);
|
|
166
|
+
}, [page, fetchManyComments, userId, sortBy, limit, include]);
|
|
167
167
|
return {
|
|
168
168
|
comments: comments,
|
|
169
169
|
loading: loadingState,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProfileComments.js","sourceRoot":"","sources":["../../../../src/hooks/comments/useProfileComments.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAiE;AAGjE,gFAA0D;AAC1D,uDAAsD;AAkBtD,SAAS,kBAAkB,CACzB,KAA8B;IADhC,iBA4GC;IAzGS,IAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"useProfileComments.js","sourceRoot":"","sources":["../../../../src/hooks/comments/useProfileComments.tsx"],"names":[],"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ntityByShortId } from "./useFetchEntityByShortId";
|
|
10
10
|
export { default as useFetchManyEntities } from "./useFetchManyEntities";
|
|
11
11
|
export { default as useIncrementEntityViews } from "./useIncrementEntityViews";
|
|
12
|
+
export { default as useProfileEntities } from "./useProfileEntities";
|
|
12
13
|
export { default as useRemoveEntityDownvote } from "./useRemoveEntityDownvote";
|
|
13
14
|
export { default as useRemoveEntityUpvote } from "./useRemoveEntityUpvote";
|
|
14
15
|
export { default as useUpdateEntity } from "./useUpdateEntity";
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useUpvoteEntity = exports.useUpdateEntity = exports.useRemoveEntityUpvote = exports.useRemoveEntityDownvote = exports.useIncrementEntityViews = exports.useFetchManyEntities = exports.useFetchEntityByShortId = exports.useFetchEntityByForeignId = exports.useFetchEntity = exports.useEntityVotes = exports.useDownvoteEntity = exports.useDeleteEntity = exports.useCreateEntity = exports.useEntityData = exports.useEntity = void 0;
|
|
6
|
+
exports.useUpvoteEntity = exports.useUpdateEntity = exports.useRemoveEntityUpvote = exports.useRemoveEntityDownvote = exports.useProfileEntities = exports.useIncrementEntityViews = exports.useFetchManyEntities = exports.useFetchEntityByShortId = exports.useFetchEntityByForeignId = exports.useFetchEntity = exports.useEntityVotes = exports.useDownvoteEntity = exports.useDeleteEntity = exports.useCreateEntity = exports.useEntityData = exports.useEntity = void 0;
|
|
7
7
|
var useEntity_1 = require("./useEntity");
|
|
8
8
|
Object.defineProperty(exports, "useEntity", { enumerable: true, get: function () { return __importDefault(useEntity_1).default; } });
|
|
9
9
|
var useEntityData_1 = require("./useEntityData");
|
|
@@ -26,6 +26,8 @@ var useFetchManyEntities_1 = require("./useFetchManyEntities");
|
|
|
26
26
|
Object.defineProperty(exports, "useFetchManyEntities", { enumerable: true, get: function () { return __importDefault(useFetchManyEntities_1).default; } });
|
|
27
27
|
var useIncrementEntityViews_1 = require("./useIncrementEntityViews");
|
|
28
28
|
Object.defineProperty(exports, "useIncrementEntityViews", { enumerable: true, get: function () { return __importDefault(useIncrementEntityViews_1).default; } });
|
|
29
|
+
var useProfileEntities_1 = require("./useProfileEntities");
|
|
30
|
+
Object.defineProperty(exports, "useProfileEntities", { enumerable: true, get: function () { return __importDefault(useProfileEntities_1).default; } });
|
|
29
31
|
var useRemoveEntityDownvote_1 = require("./useRemoveEntityDownvote");
|
|
30
32
|
Object.defineProperty(exports, "useRemoveEntityDownvote", { enumerable: true, get: function () { return __importDefault(useRemoveEntityDownvote_1).default; } });
|
|
31
33
|
var useRemoveEntityUpvote_1 = require("./useRemoveEntityUpvote");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/entities/index.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAmD;AAA1C,uHAAA,OAAO,OAAa;AAC7B,iDAA2D;AAAlD,+HAAA,OAAO,OAAiB;AAEjC,qDAA+D;AAAtD,mIAAA,OAAO,OAAmB;AACnC,qDAA+D;AAAtD,mIAAA,OAAO,OAAmB;AACnC,yDAAmE;AAA1D,uIAAA,OAAO,OAAqB;AACrC,mDAA6D;AAApD,iIAAA,OAAO,OAAkB;AAClC,mDAA6D;AAApD,iIAAA,OAAO,OAAkB;AAClC,yEAAmF;AAA1E,uJAAA,OAAO,OAA6B;AAC7C,qEAA+E;AAAtE,mJAAA,OAAO,OAA2B;AAC3C,+DAAyE;AAAhE,6IAAA,OAAO,OAAwB;AACxC,qEAA+E;AAAtE,mJAAA,OAAO,OAA2B;AAC3C,qEAA+E;AAAtE,mJAAA,OAAO,OAA2B;AAC3C,iEAA2E;AAAlE,+IAAA,OAAO,OAAyB;AACzC,qDAA+D;AAAtD,mIAAA,OAAO,OAAmB;AACnC,qDAA+D;AAAtD,mIAAA,OAAO,OAAmB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/entities/index.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAmD;AAA1C,uHAAA,OAAO,OAAa;AAC7B,iDAA2D;AAAlD,+HAAA,OAAO,OAAiB;AAEjC,qDAA+D;AAAtD,mIAAA,OAAO,OAAmB;AACnC,qDAA+D;AAAtD,mIAAA,OAAO,OAAmB;AACnC,yDAAmE;AAA1D,uIAAA,OAAO,OAAqB;AACrC,mDAA6D;AAApD,iIAAA,OAAO,OAAkB;AAClC,mDAA6D;AAApD,iIAAA,OAAO,OAAkB;AAClC,yEAAmF;AAA1E,uJAAA,OAAO,OAA6B;AAC7C,qEAA+E;AAAtE,mJAAA,OAAO,OAA2B;AAC3C,+DAAyE;AAAhE,6IAAA,OAAO,OAAwB;AACxC,qEAA+E;AAAtE,mJAAA,OAAO,OAA2B;AAC3C,2DAAqE;AAA5D,yIAAA,OAAO,OAAsB;AACtC,qEAA+E;AAAtE,mJAAA,OAAO,OAA2B;AAC3C,iEAA2E;AAAlE,+IAAA,OAAO,OAAyB;AACzC,qDAA+D;AAAtD,mIAAA,OAAO,OAAmB;AACnC,qDAA+D;AAAtD,mIAAA,OAAO,OAAmB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { EntityListSortByOptions, SortDirection, SortType } from "../../interfaces/EntityListSortByOptions";
|
|
2
|
+
import { Entity, EntityIncludeParam } from "../../interfaces/models/Entity";
|
|
3
|
+
import { TimeFrame } from "../../interfaces/TimeFrame";
|
|
4
|
+
export interface UseProfileEntitiesProps {
|
|
5
|
+
userId: string | undefined | null;
|
|
6
|
+
limit?: number;
|
|
7
|
+
defaultSortBy?: EntityListSortByOptions;
|
|
8
|
+
defaultSortDir?: SortDirection;
|
|
9
|
+
defaultSortType?: SortType;
|
|
10
|
+
timeFrame?: TimeFrame | null;
|
|
11
|
+
sourceId?: string | null;
|
|
12
|
+
spaceId?: string | null;
|
|
13
|
+
include?: EntityIncludeParam;
|
|
14
|
+
}
|
|
15
|
+
export interface UseProfileEntitiesValues {
|
|
16
|
+
entities: Entity[];
|
|
17
|
+
loading: boolean;
|
|
18
|
+
hasMore: boolean;
|
|
19
|
+
sortBy: EntityListSortByOptions;
|
|
20
|
+
sortDir: SortDirection;
|
|
21
|
+
sortType: SortType;
|
|
22
|
+
setSortBy: (newSortBy: EntityListSortByOptions) => void;
|
|
23
|
+
setSortDir: (newSortDir: SortDirection) => void;
|
|
24
|
+
setSortType: (newSortType: SortType) => void;
|
|
25
|
+
loadMore: () => void;
|
|
26
|
+
}
|
|
27
|
+
declare function useProfileEntities(props: UseProfileEntitiesProps): UseProfileEntitiesValues;
|
|
28
|
+
export default useProfileEntities;
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
39
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
40
|
+
if (ar || !(i in from)) {
|
|
41
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
42
|
+
ar[i] = from[i];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
46
|
+
};
|
|
47
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
+
};
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
var react_1 = require("react");
|
|
52
|
+
var useFetchManyEntities_1 = __importDefault(require("./useFetchManyEntities"));
|
|
53
|
+
var handleError_1 = require("../../utils/handleError");
|
|
54
|
+
function useProfileEntities(props) {
|
|
55
|
+
var _this = this;
|
|
56
|
+
var userId = props.userId, _a = props.limit, limit = _a === void 0 ? 10 : _a, _b = props.defaultSortBy, defaultSortBy = _b === void 0 ? "new" : _b, _c = props.defaultSortDir, defaultSortDir = _c === void 0 ? "desc" : _c, _d = props.defaultSortType, defaultSortType = _d === void 0 ? "auto" : _d, timeFrame = props.timeFrame, sourceId = props.sourceId, spaceId = props.spaceId, include = props.include;
|
|
57
|
+
var fetchManyEntities = (0, useFetchManyEntities_1.default)();
|
|
58
|
+
var loading = (0, react_1.useRef)(true);
|
|
59
|
+
var _e = (0, react_1.useState)(true), loadingState = _e[0], setLoadingState = _e[1];
|
|
60
|
+
var hasMore = (0, react_1.useRef)(true);
|
|
61
|
+
var _f = (0, react_1.useState)(true), hasMoreState = _f[0], setHasMoreState = _f[1];
|
|
62
|
+
var _g = (0, react_1.useState)(defaultSortBy), sortBy = _g[0], setSortBy = _g[1];
|
|
63
|
+
var _h = (0, react_1.useState)(defaultSortDir), sortDir = _h[0], setSortDir = _h[1];
|
|
64
|
+
var _j = (0, react_1.useState)(defaultSortType), sortType = _j[0], setSortType = _j[1];
|
|
65
|
+
var _k = (0, react_1.useState)(1), page = _k[0], setPage = _k[1];
|
|
66
|
+
var _l = (0, react_1.useState)([]), entities = _l[0], setEntities = _l[1];
|
|
67
|
+
var resetEntities = (0, react_1.useCallback)(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
68
|
+
var response, newEntities, pagination, err_1;
|
|
69
|
+
return __generator(this, function (_a) {
|
|
70
|
+
switch (_a.label) {
|
|
71
|
+
case 0:
|
|
72
|
+
if (!userId) {
|
|
73
|
+
return [2 /*return*/];
|
|
74
|
+
}
|
|
75
|
+
_a.label = 1;
|
|
76
|
+
case 1:
|
|
77
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
78
|
+
loading.current = true;
|
|
79
|
+
setLoadingState(true);
|
|
80
|
+
hasMore.current = true;
|
|
81
|
+
setHasMoreState(true);
|
|
82
|
+
setPage(1);
|
|
83
|
+
return [4 /*yield*/, fetchManyEntities({
|
|
84
|
+
userId: userId,
|
|
85
|
+
page: 1,
|
|
86
|
+
sortBy: sortBy,
|
|
87
|
+
sortDir: sortDir,
|
|
88
|
+
sortType: sortType,
|
|
89
|
+
timeFrame: timeFrame,
|
|
90
|
+
sourceId: sourceId,
|
|
91
|
+
spaceId: spaceId,
|
|
92
|
+
limit: limit,
|
|
93
|
+
include: include,
|
|
94
|
+
})];
|
|
95
|
+
case 2:
|
|
96
|
+
response = _a.sent();
|
|
97
|
+
if (response) {
|
|
98
|
+
newEntities = response.data, pagination = response.pagination;
|
|
99
|
+
setEntities(newEntities);
|
|
100
|
+
hasMore.current = pagination.hasMore;
|
|
101
|
+
setHasMoreState(pagination.hasMore);
|
|
102
|
+
}
|
|
103
|
+
return [3 /*break*/, 5];
|
|
104
|
+
case 3:
|
|
105
|
+
err_1 = _a.sent();
|
|
106
|
+
(0, handleError_1.handleError)(err_1, "Failed to reset profile entities:");
|
|
107
|
+
return [3 /*break*/, 5];
|
|
108
|
+
case 4:
|
|
109
|
+
loading.current = false;
|
|
110
|
+
setLoadingState(false);
|
|
111
|
+
return [7 /*endfinally*/];
|
|
112
|
+
case 5: return [2 /*return*/];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}); }, [
|
|
116
|
+
fetchManyEntities,
|
|
117
|
+
limit,
|
|
118
|
+
sortBy,
|
|
119
|
+
sortDir,
|
|
120
|
+
sortType,
|
|
121
|
+
timeFrame,
|
|
122
|
+
sourceId,
|
|
123
|
+
spaceId,
|
|
124
|
+
userId,
|
|
125
|
+
include,
|
|
126
|
+
]);
|
|
127
|
+
var loadMore = function () {
|
|
128
|
+
if (loading.current || !hasMore.current)
|
|
129
|
+
return;
|
|
130
|
+
setPage(function (prevPage) {
|
|
131
|
+
return prevPage + 1;
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
(0, react_1.useEffect)(function () {
|
|
135
|
+
resetEntities();
|
|
136
|
+
}, [resetEntities]);
|
|
137
|
+
// useEffect to get a new batch of entities
|
|
138
|
+
(0, react_1.useEffect)(function () {
|
|
139
|
+
var loadMoreEntities = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
140
|
+
var response, newEntities_1, pagination, err_2;
|
|
141
|
+
return __generator(this, function (_a) {
|
|
142
|
+
switch (_a.label) {
|
|
143
|
+
case 0:
|
|
144
|
+
loading.current = true;
|
|
145
|
+
setLoadingState(true);
|
|
146
|
+
_a.label = 1;
|
|
147
|
+
case 1:
|
|
148
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
149
|
+
return [4 /*yield*/, fetchManyEntities({
|
|
150
|
+
userId: userId,
|
|
151
|
+
page: page,
|
|
152
|
+
sortBy: sortBy,
|
|
153
|
+
sortDir: sortDir,
|
|
154
|
+
sortType: sortType,
|
|
155
|
+
timeFrame: timeFrame,
|
|
156
|
+
sourceId: sourceId,
|
|
157
|
+
spaceId: spaceId,
|
|
158
|
+
limit: limit,
|
|
159
|
+
include: include,
|
|
160
|
+
})];
|
|
161
|
+
case 2:
|
|
162
|
+
response = _a.sent();
|
|
163
|
+
if (response) {
|
|
164
|
+
newEntities_1 = response.data, pagination = response.pagination;
|
|
165
|
+
setEntities(function (prevEntities) { return __spreadArray(__spreadArray([], prevEntities, true), newEntities_1, true); });
|
|
166
|
+
hasMore.current = pagination.hasMore;
|
|
167
|
+
setHasMoreState(pagination.hasMore);
|
|
168
|
+
}
|
|
169
|
+
return [3 /*break*/, 5];
|
|
170
|
+
case 3:
|
|
171
|
+
err_2 = _a.sent();
|
|
172
|
+
(0, handleError_1.handleError)(err_2, "Loading more entities failed:");
|
|
173
|
+
return [3 /*break*/, 5];
|
|
174
|
+
case 4:
|
|
175
|
+
loading.current = false;
|
|
176
|
+
setLoadingState(false);
|
|
177
|
+
return [7 /*endfinally*/];
|
|
178
|
+
case 5: return [2 /*return*/];
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}); };
|
|
182
|
+
// We only load more if the page changed
|
|
183
|
+
if (page > 1 && hasMore.current && !loading.current) {
|
|
184
|
+
loadMoreEntities();
|
|
185
|
+
}
|
|
186
|
+
}, [
|
|
187
|
+
page,
|
|
188
|
+
fetchManyEntities,
|
|
189
|
+
userId,
|
|
190
|
+
sortBy,
|
|
191
|
+
sortDir,
|
|
192
|
+
sortType,
|
|
193
|
+
timeFrame,
|
|
194
|
+
sourceId,
|
|
195
|
+
spaceId,
|
|
196
|
+
limit,
|
|
197
|
+
include,
|
|
198
|
+
]);
|
|
199
|
+
return {
|
|
200
|
+
entities: entities,
|
|
201
|
+
loading: loadingState,
|
|
202
|
+
hasMore: hasMoreState,
|
|
203
|
+
sortBy: sortBy,
|
|
204
|
+
sortDir: sortDir,
|
|
205
|
+
sortType: sortType,
|
|
206
|
+
setSortBy: setSortBy,
|
|
207
|
+
setSortDir: setSortDir,
|
|
208
|
+
setSortType: setSortType,
|
|
209
|
+
loadMore: loadMore,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
exports.default = useProfileEntities;
|
|
213
|
+
//# sourceMappingURL=useProfileEntities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useProfileEntities.js","sourceRoot":"","sources":["../../../../src/hooks/entities/useProfileEntities.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAiE;AAIjE,gFAA0D;AAC1D,uDAAsD;AA2BtD,SAAS,kBAAkB,CACz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AgB,EAAE,CAAC;QACrB,CAAC;IACH,CAAC,EAAE;QACD,IAAI;QACJ,iBAAiB;QACjB,MAAM;QACN,MAAM;QACN,OAAO;QACP,QAAQ;QACR,SAAS;QACT,QAAQ;QACR,OAAO;QACP,KAAK;QACL,OAAO;KACR,CAAC,CAAC;IAEH,OAAO;QACL,QAAQ,UAAA;QACR,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,YAAY;QACrB,MAAM,QAAA;QACN,OAAO,SAAA;QACP,QAAQ,UAAA;QACR,SAAS,WAAA;QACT,UAAU,YAAA;QACV,WAAW,aAAA;QACX,QAAQ,UAAA;KACT,CAAC;AACJ,CAAC;AAED,kBAAe,kBAAkB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommentsSortByOptions } from "../../interfaces/CommentsSortByOptions";
|
|
2
|
-
import { Comment } from "../../interfaces/models/Comment";
|
|
2
|
+
import { Comment, CommentIncludeParam } from "../../interfaces/models/Comment";
|
|
3
3
|
import { PaginatedResponse } from "../../interfaces/IPaginatedResponse";
|
|
4
4
|
declare function useFetchManyComments(): (props: {
|
|
5
5
|
entityId?: string | null | undefined;
|
|
@@ -8,7 +8,7 @@ declare function useFetchManyComments(): (props: {
|
|
|
8
8
|
sortBy?: CommentsSortByOptions;
|
|
9
9
|
page: number;
|
|
10
10
|
limit?: number;
|
|
11
|
-
|
|
11
|
+
include?: CommentIncludeParam;
|
|
12
12
|
sourceId?: string | null | undefined;
|
|
13
13
|
}) => Promise<PaginatedResponse<Comment>>;
|
|
14
14
|
export default useFetchManyComments;
|
|
@@ -41,20 +41,17 @@ function useFetchManyComments() {
|
|
|
41
41
|
var _this = this;
|
|
42
42
|
var projectId = useProject().projectId;
|
|
43
43
|
var fetchComments = useCallback(function (props) { return __awaiter(_this, void 0, void 0, function () {
|
|
44
|
-
var entityId, userId, parentId, sortBy, page, limit,
|
|
44
|
+
var entityId, userId, parentId, sortBy, page, limit, include, sourceId, params, response;
|
|
45
45
|
return __generator(this, function (_a) {
|
|
46
46
|
switch (_a.label) {
|
|
47
47
|
case 0:
|
|
48
|
-
entityId = props.entityId, userId = props.userId, parentId = props.parentId, sortBy = props.sortBy, page = props.page, limit = props.limit,
|
|
48
|
+
entityId = props.entityId, userId = props.userId, parentId = props.parentId, sortBy = props.sortBy, page = props.page, limit = props.limit, include = props.include, sourceId = props.sourceId;
|
|
49
49
|
if (page === 0) {
|
|
50
50
|
throw new Error("Can't fetch comments with page 0");
|
|
51
51
|
}
|
|
52
52
|
if (limit === 0) {
|
|
53
53
|
throw new Error("Can't fetch with limit 0");
|
|
54
54
|
}
|
|
55
|
-
if (!sortBy) {
|
|
56
|
-
throw new Error("Can't fetch without sortBy property");
|
|
57
|
-
}
|
|
58
55
|
if (!projectId) {
|
|
59
56
|
throw new Error("No project specified");
|
|
60
57
|
}
|
|
@@ -69,10 +66,11 @@ function useFetchManyComments() {
|
|
|
69
66
|
params.userId = userId;
|
|
70
67
|
if (parentId)
|
|
71
68
|
params.parentId = parentId;
|
|
72
|
-
if (includeEntity)
|
|
73
|
-
params.includeEntity = includeEntity;
|
|
74
69
|
if (sourceId)
|
|
75
70
|
params.sourceId = sourceId;
|
|
71
|
+
if (include) {
|
|
72
|
+
params.include = Array.isArray(include) ? include.join(',') : include;
|
|
73
|
+
}
|
|
76
74
|
return [4 /*yield*/, axios.get("/".concat(projectId, "/comments"), {
|
|
77
75
|
params: params,
|
|
78
76
|
})];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchManyComments.js","sourceRoot":"","sources":["../../../../src/hooks/comments/useFetchManyComments.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAIpC,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,KAAK,MAAM,oBAAoB,CAAC;AAEvC,SAAS,oBAAoB;IAA7B,
|
|
1
|
+
{"version":3,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BACzC,IAAI,QAAQ;wBAAE,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;oBAEzC,IAAI,OAAO,EAAE,CAAC;wBACZ,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;oBACxE,CAAC;oBAEgB,qBAAM,KAAK,CAAC,GAAG,CAC9B,WAAI,SAAS,cAAW,EACxB;4BACE,MAAM,QAAA;yBACP,CACF,EAAA;;oBALK,QAAQ,GAAG,SAKhB;oBACD,sBAAO,QAAQ,CAAC,IAAI,EAAC;;;SACtB,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CommentsSortByOptions } from "../../interfaces/CommentsSortByOptions";
|
|
2
|
-
import { Comment } from "../../interfaces/models/Comment";
|
|
2
|
+
import { Comment, CommentIncludeParam } from "../../interfaces/models/Comment";
|
|
3
3
|
export interface UseProfileCommentsProps {
|
|
4
4
|
userId: string | undefined | null;
|
|
5
5
|
limit?: number;
|
|
6
6
|
defaultSortBy?: CommentsSortByOptions;
|
|
7
|
-
|
|
7
|
+
include?: CommentIncludeParam;
|
|
8
8
|
}
|
|
9
9
|
export interface UseProfileCommentsValues {
|
|
10
10
|
comments: Comment[];
|
|
@@ -48,7 +48,7 @@ import useFetchManyComments from "./useFetchManyComments";
|
|
|
48
48
|
import { handleError } from "../../utils/handleError";
|
|
49
49
|
function useProfileComments(props) {
|
|
50
50
|
var _this = this;
|
|
51
|
-
var userId = props.userId, _a = props.limit, limit = _a === void 0 ? 10 : _a, _b = props.defaultSortBy, defaultSortBy = _b === void 0 ? "new" : _b,
|
|
51
|
+
var userId = props.userId, _a = props.limit, limit = _a === void 0 ? 10 : _a, _b = props.defaultSortBy, defaultSortBy = _b === void 0 ? "new" : _b, include = props.include;
|
|
52
52
|
var fetchManyComments = useFetchManyComments();
|
|
53
53
|
var loading = useRef(true);
|
|
54
54
|
var _c = useState(true), loadingState = _c[0], setLoadingState = _c[1]; // required to trigger rerenders
|
|
@@ -80,8 +80,8 @@ function useProfileComments(props) {
|
|
|
80
80
|
userId: userId,
|
|
81
81
|
page: 1,
|
|
82
82
|
sortBy: sortBy,
|
|
83
|
-
limit:
|
|
84
|
-
|
|
83
|
+
limit: limit,
|
|
84
|
+
include: include,
|
|
85
85
|
})];
|
|
86
86
|
case 2:
|
|
87
87
|
response = _a.sent();
|
|
@@ -103,7 +103,7 @@ function useProfileComments(props) {
|
|
|
103
103
|
case 5: return [2 /*return*/];
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
|
-
}); }, [fetchManyComments, limit, sortBy, userId,
|
|
106
|
+
}); }, [fetchManyComments, limit, sortBy, userId, include]);
|
|
107
107
|
var loadMore = function () {
|
|
108
108
|
if (loading.current || !hasMore.current)
|
|
109
109
|
return;
|
|
@@ -114,7 +114,7 @@ function useProfileComments(props) {
|
|
|
114
114
|
useEffect(function () {
|
|
115
115
|
resetComments();
|
|
116
116
|
}, [resetComments]);
|
|
117
|
-
// useEffect to get a new batch of
|
|
117
|
+
// useEffect to get a new batch of comments
|
|
118
118
|
useEffect(function () {
|
|
119
119
|
var loadMoreComments = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
120
120
|
var response, newComments_1, pagination, err_2;
|
|
@@ -131,7 +131,7 @@ function useProfileComments(props) {
|
|
|
131
131
|
page: page,
|
|
132
132
|
sortBy: sortBy,
|
|
133
133
|
limit: limit,
|
|
134
|
-
|
|
134
|
+
include: include,
|
|
135
135
|
})];
|
|
136
136
|
case 2:
|
|
137
137
|
response = _a.sent();
|
|
@@ -154,11 +154,11 @@ function useProfileComments(props) {
|
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
156
|
}); };
|
|
157
|
-
// We only load more if
|
|
157
|
+
// We only load more if the page changed
|
|
158
158
|
if (page > 1 && hasMore.current && !loading.current) {
|
|
159
159
|
loadMoreComments();
|
|
160
160
|
}
|
|
161
|
-
}, [page]);
|
|
161
|
+
}, [page, fetchManyComments, userId, sortBy, limit, include]);
|
|
162
162
|
return {
|
|
163
163
|
comments: comments,
|
|
164
164
|
loading: loadingState,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProfileComments.js","sourceRoot":"","sources":["../../../../src/hooks/comments/useProfileComments.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjE,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAkBtD,SAAS,kBAAkB,CACzB,KAA8B;IADhC,iBA4GC;IAzGS,IAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"useProfileComments.js","sourceRoot":"","sources":["../../../../src/hooks/comments/useProfileComments.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjE,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAkBtD,SAAS,kBAAkB,CACzB,KAA8B;IADhC,iBA4GC;IAzGS,IAAA,MAAM,GAAiD,KAAK,OAAtD,EAAE,KAA+C,KAAK,MAA1C,EAAV,KAAK,mBAAG,EAAE,KAAA,EAAE,KAAmC,KAAK,cAAnB,EAArB,aAAa,mBAAG,KAAK,KAAA,EAAE,OAAO,GAAK,KAAK,QAAV,CAAW;IACrE,IAAM,iBAAiB,GAAG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AC,OAAO,CAAC;4BACrC,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;wBACtC,CAAC;;;;wBAED,WAAW,CAAC,KAAG,EAAE,+BAA+B,CAAC,CAAC;;;wBAElD,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;wBACxB,eAAe,CAAC,KAAK,CAAC,CAAC;;;;;aAE1B,CAAC;QAEF,wCAAwC;QACxC,IAAI,IAAI,GAAG,CAAC,IAAI,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACpD,gBAAgB,EAAE,CAAC;QACrB,CAAC;IACH,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAE9D,OAAO;QACL,QAAQ,UAAA;QACR,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,YAAY;QACrB,MAAM,QAAA;QACN,SAAS,WAAA;QACT,QAAQ,UAAA;KACT,CAAC;AACJ,CAAC;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -9,6 +9,7 @@ export { default as useFetchEntityByForeignId } from "./useFetchEntityByForeignI
|
|
|
9
9
|
export { default as useFetchEntityByShortId } from "./useFetchEntityByShortId";
|
|
10
10
|
export { default as useFetchManyEntities } from "./useFetchManyEntities";
|
|
11
11
|
export { default as useIncrementEntityViews } from "./useIncrementEntityViews";
|
|
12
|
+
export { default as useProfileEntities } from "./useProfileEntities";
|
|
12
13
|
export { default as useRemoveEntityDownvote } from "./useRemoveEntityDownvote";
|
|
13
14
|
export { default as useRemoveEntityUpvote } from "./useRemoveEntityUpvote";
|
|
14
15
|
export { default as useUpdateEntity } from "./useUpdateEntity";
|
|
@@ -9,6 +9,7 @@ export { default as useFetchEntityByForeignId } from "./useFetchEntityByForeignI
|
|
|
9
9
|
export { default as useFetchEntityByShortId } from "./useFetchEntityByShortId";
|
|
10
10
|
export { default as useFetchManyEntities } from "./useFetchManyEntities";
|
|
11
11
|
export { default as useIncrementEntityViews } from "./useIncrementEntityViews";
|
|
12
|
+
export { default as useProfileEntities } from "./useProfileEntities";
|
|
12
13
|
export { default as useRemoveEntityDownvote } from "./useRemoveEntityDownvote";
|
|
13
14
|
export { default as useRemoveEntityUpvote } from "./useRemoveEntityUpvote";
|
|
14
15
|
export { default as useUpdateEntity } from "./useUpdateEntity";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/entities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,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import { EntityListSortByOptions, SortDirection, SortType } from "../../interfaces/EntityListSortByOptions";
|
|
2
|
+
import { Entity, EntityIncludeParam } from "../../interfaces/models/Entity";
|
|
3
|
+
import { TimeFrame } from "../../interfaces/TimeFrame";
|
|
4
|
+
export interface UseProfileEntitiesProps {
|
|
5
|
+
userId: string | undefined | null;
|
|
6
|
+
limit?: number;
|
|
7
|
+
defaultSortBy?: EntityListSortByOptions;
|
|
8
|
+
defaultSortDir?: SortDirection;
|
|
9
|
+
defaultSortType?: SortType;
|
|
10
|
+
timeFrame?: TimeFrame | null;
|
|
11
|
+
sourceId?: string | null;
|
|
12
|
+
spaceId?: string | null;
|
|
13
|
+
include?: EntityIncludeParam;
|
|
14
|
+
}
|
|
15
|
+
export interface UseProfileEntitiesValues {
|
|
16
|
+
entities: Entity[];
|
|
17
|
+
loading: boolean;
|
|
18
|
+
hasMore: boolean;
|
|
19
|
+
sortBy: EntityListSortByOptions;
|
|
20
|
+
sortDir: SortDirection;
|
|
21
|
+
sortType: SortType;
|
|
22
|
+
setSortBy: (newSortBy: EntityListSortByOptions) => void;
|
|
23
|
+
setSortDir: (newSortDir: SortDirection) => void;
|
|
24
|
+
setSortType: (newSortType: SortType) => void;
|
|
25
|
+
loadMore: () => void;
|
|
26
|
+
}
|
|
27
|
+
declare function useProfileEntities(props: UseProfileEntitiesProps): UseProfileEntitiesValues;
|
|
28
|
+
export default useProfileEntities;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
38
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
39
|
+
if (ar || !(i in from)) {
|
|
40
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
41
|
+
ar[i] = from[i];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
45
|
+
};
|
|
46
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
47
|
+
import useFetchManyEntities from "./useFetchManyEntities";
|
|
48
|
+
import { handleError } from "../../utils/handleError";
|
|
49
|
+
function useProfileEntities(props) {
|
|
50
|
+
var _this = this;
|
|
51
|
+
var userId = props.userId, _a = props.limit, limit = _a === void 0 ? 10 : _a, _b = props.defaultSortBy, defaultSortBy = _b === void 0 ? "new" : _b, _c = props.defaultSortDir, defaultSortDir = _c === void 0 ? "desc" : _c, _d = props.defaultSortType, defaultSortType = _d === void 0 ? "auto" : _d, timeFrame = props.timeFrame, sourceId = props.sourceId, spaceId = props.spaceId, include = props.include;
|
|
52
|
+
var fetchManyEntities = useFetchManyEntities();
|
|
53
|
+
var loading = useRef(true);
|
|
54
|
+
var _e = useState(true), loadingState = _e[0], setLoadingState = _e[1];
|
|
55
|
+
var hasMore = useRef(true);
|
|
56
|
+
var _f = useState(true), hasMoreState = _f[0], setHasMoreState = _f[1];
|
|
57
|
+
var _g = useState(defaultSortBy), sortBy = _g[0], setSortBy = _g[1];
|
|
58
|
+
var _h = useState(defaultSortDir), sortDir = _h[0], setSortDir = _h[1];
|
|
59
|
+
var _j = useState(defaultSortType), sortType = _j[0], setSortType = _j[1];
|
|
60
|
+
var _k = useState(1), page = _k[0], setPage = _k[1];
|
|
61
|
+
var _l = useState([]), entities = _l[0], setEntities = _l[1];
|
|
62
|
+
var resetEntities = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
63
|
+
var response, newEntities, pagination, err_1;
|
|
64
|
+
return __generator(this, function (_a) {
|
|
65
|
+
switch (_a.label) {
|
|
66
|
+
case 0:
|
|
67
|
+
if (!userId) {
|
|
68
|
+
return [2 /*return*/];
|
|
69
|
+
}
|
|
70
|
+
_a.label = 1;
|
|
71
|
+
case 1:
|
|
72
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
73
|
+
loading.current = true;
|
|
74
|
+
setLoadingState(true);
|
|
75
|
+
hasMore.current = true;
|
|
76
|
+
setHasMoreState(true);
|
|
77
|
+
setPage(1);
|
|
78
|
+
return [4 /*yield*/, fetchManyEntities({
|
|
79
|
+
userId: userId,
|
|
80
|
+
page: 1,
|
|
81
|
+
sortBy: sortBy,
|
|
82
|
+
sortDir: sortDir,
|
|
83
|
+
sortType: sortType,
|
|
84
|
+
timeFrame: timeFrame,
|
|
85
|
+
sourceId: sourceId,
|
|
86
|
+
spaceId: spaceId,
|
|
87
|
+
limit: limit,
|
|
88
|
+
include: include,
|
|
89
|
+
})];
|
|
90
|
+
case 2:
|
|
91
|
+
response = _a.sent();
|
|
92
|
+
if (response) {
|
|
93
|
+
newEntities = response.data, pagination = response.pagination;
|
|
94
|
+
setEntities(newEntities);
|
|
95
|
+
hasMore.current = pagination.hasMore;
|
|
96
|
+
setHasMoreState(pagination.hasMore);
|
|
97
|
+
}
|
|
98
|
+
return [3 /*break*/, 5];
|
|
99
|
+
case 3:
|
|
100
|
+
err_1 = _a.sent();
|
|
101
|
+
handleError(err_1, "Failed to reset profile entities:");
|
|
102
|
+
return [3 /*break*/, 5];
|
|
103
|
+
case 4:
|
|
104
|
+
loading.current = false;
|
|
105
|
+
setLoadingState(false);
|
|
106
|
+
return [7 /*endfinally*/];
|
|
107
|
+
case 5: return [2 /*return*/];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}); }, [
|
|
111
|
+
fetchManyEntities,
|
|
112
|
+
limit,
|
|
113
|
+
sortBy,
|
|
114
|
+
sortDir,
|
|
115
|
+
sortType,
|
|
116
|
+
timeFrame,
|
|
117
|
+
sourceId,
|
|
118
|
+
spaceId,
|
|
119
|
+
userId,
|
|
120
|
+
include,
|
|
121
|
+
]);
|
|
122
|
+
var loadMore = function () {
|
|
123
|
+
if (loading.current || !hasMore.current)
|
|
124
|
+
return;
|
|
125
|
+
setPage(function (prevPage) {
|
|
126
|
+
return prevPage + 1;
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
useEffect(function () {
|
|
130
|
+
resetEntities();
|
|
131
|
+
}, [resetEntities]);
|
|
132
|
+
// useEffect to get a new batch of entities
|
|
133
|
+
useEffect(function () {
|
|
134
|
+
var loadMoreEntities = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
135
|
+
var response, newEntities_1, pagination, err_2;
|
|
136
|
+
return __generator(this, function (_a) {
|
|
137
|
+
switch (_a.label) {
|
|
138
|
+
case 0:
|
|
139
|
+
loading.current = true;
|
|
140
|
+
setLoadingState(true);
|
|
141
|
+
_a.label = 1;
|
|
142
|
+
case 1:
|
|
143
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
144
|
+
return [4 /*yield*/, fetchManyEntities({
|
|
145
|
+
userId: userId,
|
|
146
|
+
page: page,
|
|
147
|
+
sortBy: sortBy,
|
|
148
|
+
sortDir: sortDir,
|
|
149
|
+
sortType: sortType,
|
|
150
|
+
timeFrame: timeFrame,
|
|
151
|
+
sourceId: sourceId,
|
|
152
|
+
spaceId: spaceId,
|
|
153
|
+
limit: limit,
|
|
154
|
+
include: include,
|
|
155
|
+
})];
|
|
156
|
+
case 2:
|
|
157
|
+
response = _a.sent();
|
|
158
|
+
if (response) {
|
|
159
|
+
newEntities_1 = response.data, pagination = response.pagination;
|
|
160
|
+
setEntities(function (prevEntities) { return __spreadArray(__spreadArray([], prevEntities, true), newEntities_1, true); });
|
|
161
|
+
hasMore.current = pagination.hasMore;
|
|
162
|
+
setHasMoreState(pagination.hasMore);
|
|
163
|
+
}
|
|
164
|
+
return [3 /*break*/, 5];
|
|
165
|
+
case 3:
|
|
166
|
+
err_2 = _a.sent();
|
|
167
|
+
handleError(err_2, "Loading more entities failed:");
|
|
168
|
+
return [3 /*break*/, 5];
|
|
169
|
+
case 4:
|
|
170
|
+
loading.current = false;
|
|
171
|
+
setLoadingState(false);
|
|
172
|
+
return [7 /*endfinally*/];
|
|
173
|
+
case 5: return [2 /*return*/];
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}); };
|
|
177
|
+
// We only load more if the page changed
|
|
178
|
+
if (page > 1 && hasMore.current && !loading.current) {
|
|
179
|
+
loadMoreEntities();
|
|
180
|
+
}
|
|
181
|
+
}, [
|
|
182
|
+
page,
|
|
183
|
+
fetchManyEntities,
|
|
184
|
+
userId,
|
|
185
|
+
sortBy,
|
|
186
|
+
sortDir,
|
|
187
|
+
sortType,
|
|
188
|
+
timeFrame,
|
|
189
|
+
sourceId,
|
|
190
|
+
spaceId,
|
|
191
|
+
limit,
|
|
192
|
+
include,
|
|
193
|
+
]);
|
|
194
|
+
return {
|
|
195
|
+
entities: entities,
|
|
196
|
+
loading: loadingState,
|
|
197
|
+
hasMore: hasMoreState,
|
|
198
|
+
sortBy: sortBy,
|
|
199
|
+
sortDir: sortDir,
|
|
200
|
+
sortType: sortType,
|
|
201
|
+
setSortBy: setSortBy,
|
|
202
|
+
setSortDir: setSortDir,
|
|
203
|
+
setSortType: setSortType,
|
|
204
|
+
loadMore: loadMore,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
export default useProfileEntities;
|
|
208
|
+
//# sourceMappingURL=useProfileEntities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useProfileEntities.js","sourceRoot":"","sources":["../../../../src/hooks/entities/useProfileEntities.tsx"],"names":[],"mappings":";;;;;;;;;;;;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