Skip to content

Merge develop into preprod #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 51 commits into
base: preprod
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
85455d2
Merge pull request #1 from RealT-Community/develop
Sigri44 Jul 6, 2023
c360b1c
Merge pull request #6 from RealT-Community/develop
Kurtisone Jul 17, 2023
cddc66a
Merge pull request #22 from RealT-Community/develop
jycssu-com Nov 22, 2023
30e34dc
Merge pull request #23 from RealT-Community/develop
jycssu-com Nov 22, 2023
8331423
Merge pull request #24 from RealT-Community/develop
jycssu-com Nov 23, 2023
039d0e6
Merge pull request #30 from RealT-Community/develop
jycssu-com Dec 10, 2023
bbe571f
Merge pull request #37 from RealT-Community/develop
jycssu-com Feb 17, 2024
a9066ca
Merge pull request #39 from RealT-Community/develop
jycssu-com Mar 25, 2024
7540c64
Merge pull request #52 from RealToken-Community/develop
AlexRLT Jul 4, 2024
8378c86
Merge pull request #56 from RealToken-Community/master
AlexRLT Jul 13, 2024
13d097e
Revert "Master"
AlexRLT Jul 13, 2024
7704a72
Merge pull request #57 from RealToken-Community/revert-56-master
AlexRLT Jul 13, 2024
10767fe
Merge branch 'develop' into preprod
jycssu-com Jul 15, 2024
e304ef6
Merge branch 'develop' into preprod
jycssu-com Jul 17, 2024
92dd014
Merge pull request #59 from RealToken-Community/preprod
jycssu-com Jul 17, 2024
9e00655
Merge pull request #66 from RealToken-Community/develop
AlexRLT Aug 25, 2024
3f46b2d
merge preprod <> master (#67)
AlexRLT Aug 25, 2024
8ba6b9a
Merge pull request #71 from RealToken-Community/develop
AlexRLT Aug 26, 2024
072a3c7
Merge pull request #76 from RealToken-Community/develop
AlexRLT Aug 30, 2024
3fca9df
Merge branch 'master' into preprod
NandyBa Aug 31, 2024
68daad5
merge preprod <> master (#77)
AlexRLT Aug 31, 2024
158465f
Revert "merge preprod <> master (#77)"
NandyBa Aug 31, 2024
ed61a4c
Merge pull request #80 from RealToken-Community/revert-77-preprod
AlexRLT Aug 31, 2024
2d6bbf3
Merge pull request #81 from RealToken-Community/develop
AlexRLT Sep 1, 2024
80f8e5a
fix: APY fully rented for properties before start rent day (#85)
NandyBa Sep 1, 2024
2f930b5
Merge pull request #86 from RealToken-Community/preprod
AlexRLT Sep 1, 2024
d8628cb
Merge pull request #88 from RealToken-Community/develop
jycssu-com Oct 23, 2024
1d73c53
Change NS for RealToken (#89) (#90)
Sigri44 Oct 24, 2024
77880df
fix: unchecked asset filters (#95)
NandyBa Dec 18, 2024
7f35422
merge master in develop (#103)
NandyBa Dec 18, 2024
68dfdcf
Merge branch 'master' into develop
NandyBa Dec 18, 2024
0d7f8fe
feat: restrict merges to preprod (#104)
NandyBa Dec 18, 2024
f81f456
merge develop into master (#102) (#107)
NandyBa Dec 19, 2024
db54874
feat: add workflow to restrict merges to master (#108)
NandyBa Dec 21, 2024
d31c2ab
feat: add product type filter (#94)
NandyBa Dec 21, 2024
e8d140e
Prevents settings menu from closing while clicking on calendar (#113)
BenoistP Jan 26, 2025
eb79909
fix: other asset balance by wallet (#112)
BenoistP Mar 1, 2025
ca743df
feat: optimize RPC calls (#114)
NandyBa Mar 24, 2025
8aa4fbe
73 feature add matomo analytics 2 (#110)
BenoistP Mar 24, 2025
f384bf1
deployment fix
BenoistP Mar 24, 2025
519c770
Merge branch 'preprod' into develop
BenoistP May 3, 2025
f605c36
Clean env
Sigri44 May 4, 2025
dff64f2
Update branch.yml
Sigri44 May 4, 2025
3e8137e
Fix spellcheck
Sigri44 May 4, 2025
6ad827c
Fix spellcheck
Sigri44 May 4, 2025
e23d166
Fix spellcheck
Sigri44 May 4, 2025
d79a793
Clean README
Sigri44 May 4, 2025
8f5b958
Fix spellcheck
Sigri44 May 4, 2025
e8823ef
Add id site for matomo
Sigri44 May 5, 2025
7a9050a
Fix matomo id
Sigri44 May 5, 2025
739f583
Factoring tokens added (#121)
BenoistP May 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ BUILD_ENV=
COMMUNITY_API_KEY=
THEGRAPH_API_KEY=
REALTOKENAPI='https://api.realtoken.community/v1/token'
REALTOKENAPI_HISTORY='https://history.api.realtoken.community/'
REALTOKENAPI_HISTORY='https://history.api.realtoken.community/'
MATOMO_URL='https://data.realtoken.community/'
MATOMO_SITE_ID=
17 changes: 17 additions & 0 deletions .github/workflows/branch-check-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Restrict merges to master

on:
pull_request:
branches:
- master

jobs:
check-branch-master:
runs-on: ubuntu-latest
steps:
- name: Check if the source branch is preprod
run: |
if [ "${{ github.event.pull_request.head.ref }}" != "preprod" ]; then
echo "Pull requests to master must come from preprod branch."
exit 1
fi
2 changes: 2 additions & 0 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,7 @@ jobs:
COMMUNITY_API_KEY=${{ secrets.COMMUNITY_API_KEY }} \
REALTOKENAPI=https://api.realtoken.community/v1/token \
REALTOKENAPI_HISTORY=https://history.api.realtoken.community/ \
MATOMO_URL=https://data.realtoken.community/ \
MATOMO_SITE_ID=${{ github.ref_name == 'master' && secrets.MATOMO_ID_PROD || github.ref_name == 'preprod' && secrets.MATOMO_ID_PREPROD || secrets.MATOMO_ID_DEVELOP }} \
HOSTNAME=${{ github.ref_name == 'master' && 'dashboard.realtoken.community' || 'dashboard.${DOCKER_BRANCH}.realtoken.community' }} \
docker compose --project-name ${{ github.ref_name }}-dashboard --file docker-compose-branch.yml up -d'
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,11 @@

### <a name="env">Environment</a>

To run the project you will need to set-up a `.env` file in the root folder:

```
COMMUNITY_API_KEY=XXXXXXXXXXXX
THEGRAPH_API_KEY=XXXXXXXXXXXX

REALTOKENAPI='https://api.realtoken.community/v1/token'
REALTOKENAPI_HISTORY='https://history.api.realtoken.community/'
```
To run the project you will need to set-up a `.env` file in the root folder, by copy/paste `.env.sample` file.

To get a `COMMUNITY_API_KEY`, join the dedicated [telegram dev channel](https://t.me/+XQyoaFfmN61yk7X0) then ask for.

To get a THEGRAPH_API_KEY, you need to create an account on thegraph.com [Thegraph docs](https://thegraph.com/docs/en/querying/managing-api-keys/)
To get a `THEGRAPH_API_KEY`, you need to create an account on [thegraph](https://thegraph.com/docs/en/querying/managing-api-keys/)

### Node.js version

Expand Down
2 changes: 2 additions & 0 deletions docker-compose-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ services:
- COMMUNITY_API_KEY=$COMMUNITY_API_KEY
- REALTOKENAPI=$REALTOKENAPI
- REALTOKENAPI_HISTORY=$REALTOKENAPI_HISTORY
- MATOMO_URL=$MATOMO_URL
- MATOMO_SITE_ID=$MATOMO_SITE_ID
networks:
- traefik-realt
labels:
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"dependencies": {
"@apollo/client": "^3.9.5",
"@bgd-labs/aave-address-book": "^4.7.3",
"@mantine/core": "^7.5.3",
"@mantine/dates": "^7.5.3",
"@mantine/form": "^7.5.3",
Expand All @@ -26,6 +27,7 @@
"@mantine/notifications": "^7.5.3",
"@realtoken/realt-commons": "1.4.6",
"@reduxjs/toolkit": "^2.2.1",
"@socialgouv/matomo-next": "^1.9.2",
"@tabler/icons": "^1.74.0",
"@web3-react/core": "^8.0.35-beta.0",
"cookies-next": "^2.0.5",
Expand Down
23 changes: 23 additions & 0 deletions src/components/assetsView/filters/AssetsViewFilterModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { FC, useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
import { useDispatch } from 'react-redux'

import { Button, Flex, Stack } from '@mantine/core'
import { ContextModalProps } from '@mantine/modals'
Expand All @@ -11,7 +13,11 @@ import {
assetsViewDefaultFilter,
assetsViewFilterAtom,
} from 'src/states'
import { selectUserIncludesOtherAssets } from 'src/store/features/settings/settingsSelector'
import { userIncludesOtherAssetsChanged } from 'src/store/features/settings/settingsSlice'

import { AssetProductType } from '../types'
import { AssetsViewProductTypeFilter } from './AssetsViewFilterProductType'
import { AssetsViewRentStatusFilter } from './AssetsViewRentStatusFilter'
import { AssetsViewRmmStatusFilter } from './AssetsViewRmmStatusFilter'
import { AssetsViewSort } from './AssetsViewSort'
Expand Down Expand Up @@ -49,11 +55,22 @@ export const AssetsViewFilterModal: FC<ContextModalProps> = ({
const [filterModel, setFilterModel] =
useState<AssetsViewFilterType>(activeFilter)

const userIncludesOtherAssets = useSelector(selectUserIncludesOtherAssets)
const dispatch = useDispatch()
const setUserIncludesOtherAssets = (value: boolean) =>
dispatch(userIncludesOtherAssetsChanged(value))

const onClose = useCallback(() => {
context.closeModal(id)
}, [context, id])

const onSubmit = () => {
if (
filterModel.productType === AssetProductType.EQUITY_TOKEN &&
!userIncludesOtherAssets
) {
setUserIncludesOtherAssets(true) // as all equity token are part of other assets we automatically activate their fetch if the user selects equity token
}
applyFilter(filterModel)
onClose()
}
Expand All @@ -76,6 +93,12 @@ export const AssetsViewFilterModal: FC<ContextModalProps> = ({
setFilterModel({ ...filterModel, ...value })
}}
/>
<AssetsViewProductTypeFilter
filter={filterModel}
onChange={(value) => {
setFilterModel({ ...filterModel, ...value })
}}
/>
<AssetsViewUserProtocolFilter
filter={filterModel}
onChange={(value) => {
Expand Down
89 changes: 89 additions & 0 deletions src/components/assetsView/filters/AssetsViewFilterProductType.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import { FC } from 'react'
import { useTranslation } from 'react-i18next'

import { Select } from '@mantine/core'

import { assetsViewDefaultFilter } from 'src/states'
import {
OtherRealtoken,
UserRealtoken,
} from 'src/store/features/wallets/walletsSelector'
import { APIRealTokenProductType } from 'src/types/APIRealToken'

import { useInputStyles } from '../../inputs/useInputStyles'
import { AssetProductType } from '../types'

interface AssetsViewFilterType {
productType: AssetProductType
}

interface AssetsViewProductTypeFilterProps {
filter: AssetsViewFilterType
onChange: (value: AssetsViewFilterType) => void
}
export const AssetsViewProductTypeFilter: FC<
AssetsViewProductTypeFilterProps
> = ({ filter, onChange }) => {
const { t } = useTranslation('common', { keyPrefix: 'assetProductType' })
const { classes: inputClasses } = useInputStyles()

const viewOptions = [
{
value: AssetProductType.ALL,
label: t('options.all'),
},
{
value: AssetProductType.REAL_ESTATE_RENTAL,
label: t('options.realEstateRental'),
},
{
value: AssetProductType.LOAN_INCOME,
label: t('options.loanIncome'),
},
{
value: AssetProductType.EQUITY_TOKEN,
label: t('options.equityToken'),
},
{
value: AssetProductType.FACTORING,
label: t('options.factoring'),
},
]

return (
<Select
label={t('label')}
data={viewOptions}
value={filter.productType}
onChange={(value) =>
onChange({
productType:
(value as AssetProductType) ?? assetsViewDefaultFilter.productType,
})
}
classNames={inputClasses}
/>
)
}
AssetsViewProductTypeFilter.displayName = 'AssetsViewProductTypeFilter'

export function useAssetsViewProductTypeFilter(filter: AssetsViewFilterType) {
function assetProductTypeFilterFunction(
asset: UserRealtoken | OtherRealtoken,
) {
switch (filter.productType) {
case AssetProductType.ALL:
return true
case AssetProductType.REAL_ESTATE_RENTAL:
return asset.productType === APIRealTokenProductType.RealEstateRental
case AssetProductType.LOAN_INCOME:
return asset.productType === APIRealTokenProductType.LoanIncome
case AssetProductType.EQUITY_TOKEN:
return asset.productType === APIRealTokenProductType.EquityToken
case AssetProductType.FACTORING:
return asset.productType === APIRealTokenProductType.Factoring
}
}

return { assetProductTypeFilterFunction }
}
4 changes: 4 additions & 0 deletions src/components/assetsView/filters/useFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
UserRealtoken,
} from 'src/store/features/wallets/walletsSelector'

import { useAssetsViewProductTypeFilter } from './AssetsViewFilterProductType'
import { useAssetsViewRentStatusFilter } from './AssetsViewRentStatusFilter'
import { useAssetsViewRmmStatusFilter } from './AssetsViewRmmStatusFilter'
import { useAssetsViewSort } from './AssetsViewSort'
Expand All @@ -22,6 +23,8 @@ export function useAssetsViewFilters() {
useAssetsViewSubsidyFilter(activeFilter)
const { assetUserStatusFilterFunction } =
useAssetsViewUserStatusFilter(activeFilter)
const { assetProductTypeFilterFunction } =
useAssetsViewProductTypeFilter(activeFilter)
const { assetRentStatusFilterFunction } =
useAssetsViewRentStatusFilter(activeFilter)
const { assetRmmStatusFilterFunction } =
Expand All @@ -35,6 +38,7 @@ export function useAssetsViewFilters() {
return tokenList
.filter(assetUserStatusFilterFunction)
.filter(assetUserProtocolFilterFunction)
.filter(assetProductTypeFilterFunction)
.filter(assetRentStatusFilterFunction)
.filter(assetSubsidyFilterFunction)
.filter(assetRmmStatusFilterFunction)
Expand Down
7 changes: 7 additions & 0 deletions src/components/assetsView/types/assetProduct.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export enum AssetProductType {
ALL = 'all',
REAL_ESTATE_RENTAL = 'real_estate_rental',
EQUITY_TOKEN = 'equity_token',
LOAN_INCOME = 'loan_income',
FACTORING = 'factoring_profitshare',
}
1 change: 1 addition & 0 deletions src/components/assetsView/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from './assetUserStatus.type'
export * from './assetRentStatus.type'
export * from './assetRmmStatus.type'
export * from './assetUserProtocol.type'
export * from './assetProduct.type'
31 changes: 25 additions & 6 deletions src/components/layouts/SettingsMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,12 @@ const RealtimeRentMenuItem: FC = () => {
)
}

const RealtimeRentMenuSelectDate: FC = () => {
const RealtimeRentMenuSelectDate: FC<{
isCalendarOpen: boolean
setIsCalendarOpen: (open: boolean) => void
}> = ({ isCalendarOpen, setIsCalendarOpen }) => {
const dispatch = useDispatch()
const rentCalculation = useSelector(selectUserRentCalculation)

const { i18n, t } = useTranslation('common', { keyPrefix: 'settings' })

if (rentCalculation.state !== RentCalculationState.Realtime) return null
Expand All @@ -162,28 +164,39 @@ const RealtimeRentMenuSelectDate: FC = () => {
}),
)
}
const toggleIsCalendarOpen = () => setIsCalendarOpen(!isCalendarOpen)

return (
<>
<Menu.Label pb={0}>{t('date')}</Menu.Label>
<DatePickerInput
p={5}
onClick={() => toggleIsCalendarOpen()}
locale={i18n.language}
valueFormat={t('dateFormat')}
value={new Date(rentCalculation.date)}
onChange={(value) => handleDateChange(value as Date)}
onChange={(value) => {
handleDateChange(value as Date)
toggleIsCalendarOpen()
}}
defaultDate={new Date()}
/>
<Menu.Divider />
</>
)
}

const RealtimeRentMenu = () => {
const RealtimeRentMenu: FC<{
isCalendarOpen: boolean
setIsCalendarOpen: (open: boolean) => void
}> = ({ isCalendarOpen, setIsCalendarOpen }) => {
return (
<>
<RealtimeRentMenuItem />
<RealtimeRentMenuSelectDate />
<RealtimeRentMenuSelectDate
isCalendarOpen={isCalendarOpen}
setIsCalendarOpen={setIsCalendarOpen}
/>
<Menu.Divider />
</>
)
Expand Down Expand Up @@ -341,10 +354,13 @@ const RefreshDataButton: FC = () => {
export const SettingsMenu: FC = () => {
const [isOpen, handlers] = useDisclosure(false)
const version = useSelector(selectVersion)
// Prevent menu from closing when the calendar is open
const [isCalendarOpen, setIsCalendarOpen] = useState(false)

return (
<Menu
closeOnItemClick={false}
closeOnClickOutside={!isCalendarOpen}
opened={isOpen}
onOpen={handlers.open}
onClose={handlers.close}
Expand All @@ -359,7 +375,10 @@ export const SettingsMenu: FC = () => {
<Menu.Divider />
<CurrencySelect />
<Menu.Divider />
<RealtimeRentMenu />
<RealtimeRentMenu
isCalendarOpen={isCalendarOpen}
setIsCalendarOpen={setIsCalendarOpen}
/>
<ColorSchemeMenuItem />
<Menu.Divider />
<FetchDataSettings />
Expand Down
Loading