Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix/last-active
Browse files Browse the repository at this point in the history
  • Loading branch information
Vyvy-vi committed Jun 23, 2023
2 parents ec5a11d + 0599091 commit 9f3e601
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 3 deletions.
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/issue-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Issue template
about: General issue template for new features etc
title: ''
labels: ''
assignees: ''

---

## User story

## Main success scenario

## Details

## Open questions

## Wireframes

## Links and docs

## Who should be kept in the loop?
31 changes: 31 additions & 0 deletions packages/api-types/out/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface paths {
/** Verifies a user's signature and returns a JWT token */
post: operations['EthSignatureController_login'];
};
'/api/auth/eth-signature/refresh': {
/** Verifies a refreshToken and returns a JWT token */
post: operations['EthSignatureController_token'];
};
'/api/communities': {
get: operations['CommunityController_findAll'];
/** Create a new community */
Expand Down Expand Up @@ -926,12 +930,18 @@ export interface components {
LoginResponseDto: {
/** @example eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2MmIwNmY3NjU1ODA0YjE2MjllODQxNTkiLCJpZGVudGl0eUV0aEFkZHJlc3MiOiIweGEzMmFFQ2RhNzUyY0Y0RUY4OTk1NmU4M2Q2MEMwNDgzNWQ0RkE4NjciLCJyb2xlcyI6WyJVU0VSIiwiQURNSU4iXSwiaXNSZWZyZXNoIjpmYWxzZSwiaWF0IjoxNjcwMzE1OTk4LCJleHAiOjE2NzAzMTk1OTh9.qKvucMZLVbz_1TnsxaSqYX1i5CSpver6fFJTf3pABVA */
accessToken: string;
/** @example eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2MmIwNmY3NjU1ODA0YjE2MjllODQxNTkiLCJpZGVudGl0eUV0aEFkZHJlc3MiOiIweGEzMmFFQ2RhNzUyY0Y0RUY4OTk1NmU4M2Q2MEMwNDgzNWQ0RkE4NjciLCJyb2xlcyI6WyJVU0VSIiwiQURNSU4iXSwiaXNSZWZyZXNoIjpmYWxzZSwiaWF0IjoxNjcwMzE1OTk4LCJleHAiOjE2NzAzMTk1OTh9.qKvucMZLVbz_1TnsxaSqYX1i5CSpver6fFJTf3pABVA */
refreshToken: string;
/** @example 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 */
identityEthAddress: string;
/** @example bearer */
tokenType: string;
user: components['schemas']['User'];
};
GenerateTokenDto: {
/** @example eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2MmIwNmY3NjU1ODA0YjE2MjllODQxNTkiLCJpZGVudGl0eUV0aEFkZHJlc3MiOiIweGEzMmFFQ2RhNzUyY0Y0RUY4OTk1NmU4M2Q2MEMwNDgzNWQ0RkE4NjciLCJyb2xlcyI6WyJVU0VSIiwiQURNSU4iXSwiaXNSZWZyZXNoIjpmYWxzZSwiaWF0IjoxNjcwMzE1OTk4LCJleHAiOjE2NzAzMTk1OTh9.qKvucMZLVbz_1TnsxaSqYX1i5CSpver6fFJTf3pABVA */
refreshToken: string;
};
CreateCommunityInputDto: {
/** @example banklessdao.givepraise.xyz */
hostname: string;
Expand Down Expand Up @@ -2062,6 +2072,27 @@ export interface operations {
};
};
};
/** Verifies a refreshToken and returns a JWT token */
EthSignatureController_token: {
parameters: {
header: {
host: string;
};
};
requestBody: {
content: {
'application/json': components['schemas']['GenerateTokenDto'];
};
};
responses: {
/** @description Tokens generated successfully */
201: {
content: {
'application/json': components['schemas']['LoginResponseDto'];
};
};
};
};
CommunityController_findAll: {
parameters: {
query: {
Expand Down
2 changes: 1 addition & 1 deletion packages/api/openapi.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Link } from 'react-router-dom';
import { useRecoilValue } from 'recoil';
import { AllActiveUserQuantificationPeriods } from '@/model/periods/periods';
import {
AllActiveUserQuantificationPeriods,
useLoadAllQuantifyPeriodDetails,
} from '@/model/periods/periods';
import { PeriodDetailsDto } from '@/model/periods/dto/period-details.dto';

interface QuantifierPeriodMessageProps {
Expand All @@ -18,15 +21,17 @@ const QuantifierPeriodMessage = ({
};

export const ActiveUserQuantificationsMessage = (): JSX.Element | null => {
useLoadAllQuantifyPeriodDetails();
const activeUserQuantificationPeriods = useRecoilValue(
AllActiveUserQuantificationPeriods
);
if (
!activeUserQuantificationPeriods ||
!Array.isArray(activeUserQuantificationPeriods) ||
activeUserQuantificationPeriods.length === 0
)
) {
return null;
}

return (
<div>
Expand Down
27 changes: 27 additions & 0 deletions packages/frontend/src/model/periods/periods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,33 @@ export const AllActiveUserQuantificationPeriods = selector({
},
});

export const useLoadAllQuantifyPeriodDetails = (): void => {
const periods = useRecoilValue(AllPeriods);

const loadPeriodDetails = useRecoilCallback(({ set, snapshot }) => {
return async (periodId: string): Promise<void> => {
await snapshot
.getPromise(DetailedSinglePeriodQuery(periodId))
.then((response) => {
if (isResponseOk(response)) {
const period = response.data;
set(SinglePeriod(period._id), period);
}
});
};
});

React.useEffect(() => {
if (!periods) return;
for (const period of periods) {
if (period.status === 'QUANTIFY' && !period.numberOfPraise) {
// Having no numberOfPraise attribute means that the period details have not been loaded yet.
void loadPeriodDetails(period._id);
}
}
}, [periods, loadPeriodDetails]);
};

const useSaveGiverReceiverPraiseItems = (
response: AxiosResponse<Praise[]> | AxiosError,
listKey: string
Expand Down

0 comments on commit 9f3e601

Please sign in to comment.