Skip to content
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

Style enhancement and adjustment of partner config filter #267

Merged
merged 29 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4de884d
chore: Update page title and meta tags for Camino Application Suite
Ysrbolles Sep 10, 2024
6377efd
chore: Update page title and meta tags for Camino Suite
Ysrbolles Sep 11, 2024
351c9f4
Merge branch 'suite' into fix-suite-name
Ysrbolles Sep 13, 2024
ee18f8c
feat(MyMessenger): added supported tokens to acepted currencies
aeddaqqa Oct 9, 2024
2f01f22
styling(MyMessenger): adjust link colors in light theme
aeddaqqa Oct 9, 2024
f9870ac
Merge pull request #258 from chain4travel/aeddaqqa/fixes
aeddaqqa Oct 14, 2024
2af2cff
Update og:image meta tag in index.html
Ysrbolles Oct 14, 2024
12f5fe5
Merge pull request #259 from chain4travel/change-preview-image
Ysrbolles Oct 14, 2024
9ea1f41
feat(PartnersLayout): add meta tags for partner showroom
Ysrbolles Oct 17, 2024
7c101dd
Refactor rendering logic in App.tsx
Ysrbolles Oct 17, 2024
d381063
fix(MyMessenger): fixed configure accepted currencies
aeddaqqa Oct 17, 2024
fab8b8a
fix(MyMessenger): fixed withdraw tokens
aeddaqqa Oct 17, 2024
e8e3240
feat(MyMessenger): add accepted tokens to email generation
aeddaqqa Oct 17, 2024
e2ff931
refactor(app-config): update P-Chain address handling
Ysrbolles Oct 20, 2024
3350abb
Merge pull request #260 from chain4travel/change-MetatData
Ysrbolles Oct 21, 2024
40ed4e2
Merge pull request #261 from chain4travel/aeddaqqa/fixes
aeddaqqa Oct 21, 2024
acc50e8
feat(PartnerConfig): added check to register as partner button
aeddaqqa Oct 17, 2024
30414af
feat(PartneeView): fix displaying validator badge
aeddaqqa Oct 17, 2024
346cd83
Merge pull request #262 from chain4travel/aeddaqqa/validator-badge
aeddaqqa Oct 21, 2024
557e5e7
Merge pull request #263 from chain4travel/header-address
Ysrbolles Oct 22, 2024
0004176
feat(partnerConfig): redirect to upgrade view if needed
aeddaqqa Oct 29, 2024
4bde0c9
Merge pull request #264 from chain4travel/aeddaqqa/upgrade-view
aeddaqqa Oct 29, 2024
cffe969
feat(Partners): enhance BusinessFieldFilter with grouped display and …
Ysrbolles Oct 31, 2024
93a4897
feat(Partners): refactor PartnerBusinessFields to use grouped busines…
Ysrbolles Nov 7, 2024
bb3b7dc
Merge pull request #266 from chain4travel/business-filters
Ysrbolles Nov 11, 2024
38421ff
fix(partnerConfig) : fix filtering with only validators
aeddaqqa Nov 14, 2024
2c00e55
Merge pull request #265 from chain4travel/aeddaqqa/validators-filter
aeddaqqa Nov 14, 2024
7bd42da
Merge branch 'suite' into fix-suite-name
Ysrbolles Nov 14, 2024
e00d895
Merge pull request #234 from chain4travel/fix-suite-name
Ysrbolles Nov 14, 2024
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Camino Application Suite
# Camino Suite

This app uses Module Federation to combine three different applications with different frameworks into a single, cohesive application. The three applications are:

Expand Down
17 changes: 7 additions & 10 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Explore Camino Suite for comprehensive travel solutions by Chain4Travel. Discover more about our services and how we're revolutionizing travel."
content="Discover Camino Suite — hub for crypto wallets, on-chain data, transactions, Camino Messenger configuration, and Partner Showroom of Camino Network."
/>
<title>Camino Suite Application</title>
<meta name="keywords" content="Camino Suite" />
<title>Camino Suite</title>

<meta property="og:image" content="/preview.jpg" />
<meta
property="og:title"
content="Camino Suite Camino Suite Application: Your Gateway to Revolutionary Travel"
/>
<meta property="og:image" content="/preview.png" />
<meta property="og:title" content="Camino Suite: Your Gateway to Revolutionary Travel" />
<meta
property="og:description"
content="Explore Camino Suite for comprehensive travel solutions by Chain4Travel. Discover more about our services and how we're revolutionizing travel."
content="Discover Camino Suite — hub for crypto wallets, on-chain data, transactions, Camino Messenger configuration, and Partner Showroom of Camino Network."
/>
<meta property="og:url" content="https://suite.camino.network/" />
<meta property="og:type" content="website" />
Expand All @@ -33,8 +31,7 @@
content="Camino Suite for everything Camino by Chain4Travel."
/>
<meta name="twitter:image" content="/preview.jpg" />
<meta name="twitter:image:alt" content="Camino Suite Application" />

<meta name="twitter:image:alt" content="Camino Suite" />
<link rel="preconnect" href="https://cdn.jsdelivr.net" />
<link
rel="stylesheet"
Expand Down
4 changes: 2 additions & 2 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"short_name": "Camino Suite Application",
"name": "Camino Suite Application",
"short_name": "Camino Suite",
"name": "Camino Suite",
"icons": [
{
"src": "favicon.ico",
Expand Down
Binary file removed public/preview.jpg
Binary file not shown.
Binary file added public/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ExplorerStoreProvider } from 'Explorer/useStore'
import React from 'react'
import ReactDOM from 'react-dom/client'
import Root from './layout/index'
import { HelmetProvider } from 'react-helmet-async'
import ThemeConfig from './theme'
import { Provider as ReduxProvider } from 'react-redux'
import { configureAppStore } from './redux/store'
import './index.css'
import { ExplorerStoreProvider } from 'Explorer/useStore'
import Root from './layout/index'
import { configureAppStore } from './redux/store'
import ThemeConfig from './theme'

export const store = configureAppStore()

Expand Down
98 changes: 65 additions & 33 deletions src/components/Partners/BusinessFieldFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { ActionType, StatePartnersType, partnersActions } from '../../helpers/partnersReducer'
import Select, { SelectChangeEvent } from '@mui/material/Select'

import { mdiCheckCircle } from '@mdi/js'
import Icon from '@mdi/react'
import { Divider, Typography } from '@mui/material'
import ListItemText from '@mui/material/ListItemText'
import MenuItem from '@mui/material/MenuItem'
import Select from '@mui/material/Select'
import React from 'react'
import { Typography } from '@mui/material'
import { mdiCheckCircle } from '@mdi/js'
import { ActionType, StatePartnersType, partnersActions } from '../../helpers/partnersReducer'

interface BusinessFieldFilterProps {
state: StatePartnersType
Expand All @@ -17,19 +16,25 @@ const BusinessFieldFilter: React.FC<BusinessFieldFilterProps> = ({
state,
dispatchPartnersActions,
}) => {
const handleChange = (event: SelectChangeEvent<typeof state.businessField>) => {
const {
target: { value },
} = event
dispatchPartnersActions({ type: partnersActions.UPDATE_BUSINESS_FIELD, payload: value[1] })
const handleFieldToggle = (selectedField: string) => {
dispatchPartnersActions({
type: partnersActions.UPDATE_BUSINESS_FIELD,
payload: selectedField,
})
}

const handleCategoryToggle = (category: string) => {
dispatchPartnersActions({
type: partnersActions.TOGGLE_CATEGORY,
payload: category,
})
}

return (
<Select
multiple
// @ts-ignore
value={['default']}
onChange={handleChange}
onChange={() => {}}
sx={{
flex: '1 1 250px',
padding: '0',
Expand Down Expand Up @@ -72,27 +77,54 @@ const BusinessFieldFilter: React.FC<BusinessFieldFilterProps> = ({
},
}}
>
<MenuItem sx={{ display: 'none' }} value={'default'}>
<Typography variant="caption">Business fields</Typography>
</MenuItem>
{state.businessField.map((businessField, index) => (
<MenuItem key={index} value={businessField.name}>
<ListItemText
// sx={{ color: !businessField.active ? '#CBD4E2' : '#ffffff' }}
primary={
<Typography
variant="caption"
sx={{ fontWeight: !businessField.active ? 500 : 600 }}
>
{businessField.name}
</Typography>
}
/>
{businessField.active && (
<Icon path={mdiCheckCircle} size={1} color="#B5E3FD" />
)}
</MenuItem>
))}
{state?.businessField?.map((group, groupIndex) => [
<MenuItem
key={`category-${groupIndex}`}
onClick={() => handleCategoryToggle(group.category)}
sx={{
opacity: 0.48,
backgroundColor: theme =>
theme.palette.mode === 'dark'
? theme.palette.grey[800]
: theme.palette.grey[100],
py: 1,
}}
>
<Typography
variant="caption"
sx={{
fontWeight: 600,
color: theme => theme.palette.text.secondary,
}}
>
{group.category}
</Typography>
</MenuItem>,

...group.fields.map((field, fieldIndex) => (
<MenuItem
key={`field-${groupIndex}-${fieldIndex}`}
value={field.fullName}
onClick={() => handleFieldToggle(field.fullName)}
>
<ListItemText
primary={
<Typography
variant="caption"
sx={{ fontWeight: field.active ? 600 : 500 }}
>
{field.name}
</Typography>
}
/>
{field.active && <Icon path={mdiCheckCircle} size={1} color="#B5E3FD" />}
</MenuItem>
)),

groupIndex < state.businessField.length - 1 ? (
<Divider key={`divider-${groupIndex}`} sx={{ my: 1 }} />
) : null,
])}
</Select>
)
}
Expand Down
22 changes: 14 additions & 8 deletions src/components/Partners/PartnerBusinessFields.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
import { Box, Chip } from '@mui/material'
import React from 'react'
import { Box, Chip } from '@mui/material';

Check warning on line 1 in src/components/Partners/PartnerBusinessFields.tsx

View workflow job for this annotation

GitHub Actions / yarn-build

Delete `;`

Check warning on line 1 in src/components/Partners/PartnerBusinessFields.tsx

View workflow job for this annotation

GitHub Actions / yarn-build

Delete `;`
import React from 'react';
import { groupedBusinessFields } from '../../redux/services/partners';

type PartnerBusinessFieldsProps = { business_fields: any; isPartnerView?: boolean }

const PartnerBusinessFields = ({ business_fields, isPartnerView }: PartnerBusinessFieldsProps) => {
const flatFields = groupedBusinessFields(business_fields.data).flatMap(
category => category.fields,
)

const content =
business_fields.data.length <= 2 || isPartnerView ? (
business_fields.data.map((elem, key) => (
flatFields.length <= 2 || isPartnerView ? (
flatFields.map((field, index) => (
<Chip
key={key}
key={index}
sx={{
backgroundColor: 'transparent',
border: '1px solid',
fontSize: '12px',
borderColor: theme => theme.palette.grey['700'],
}}
label={elem.attributes.BusinessField}
label={field.name}
/>
))
) : (
Expand All @@ -27,7 +32,7 @@
fontSize: '12px',
borderColor: theme => theme.palette.grey['700'],
}}
label={business_fields.data[0].attributes.BusinessField}
label={flatFields[0].name}
/>
<Chip
sx={{
Expand All @@ -36,10 +41,11 @@
borderColor: theme => theme.palette.grey['700'],
fontSize: '12px',
}}
label={`+${business_fields.data.length - 1}`}
label={`+${flatFields.length - 1}`}
/>
</>
)

return (
<Box
sx={{
Expand Down
2 changes: 1 addition & 1 deletion src/components/Partners/PartnerCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const PartnerCard: React.FC<PartnerCardProps> = ({ partner, clickable, onClick }
useEffect(() => {
if (pChainAddresses) {
let partnerAddresses = pChainAddresses.find(
elem => elem.Network.toLowerCase() === activeNetwork?.name?.toLowerCase(),
elem => elem.Network?.toLowerCase() === activeNetwork?.name?.toLowerCase(),
)
if (partnerAddresses) chackValidatorStatus(partnerAddresses.pAddress)
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Partners/PartnerFlag.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Box, Typography } from '@mui/material'

import React from 'react'
import { CircleFlag } from 'react-circle-flags'
import { CountryFlagAttributesType } from '../../@types/partners'
import React from 'react'

interface PartnerFlagProps {
country: CountryFlagAttributesType
Expand All @@ -13,7 +13,7 @@ const PartnerFlag: React.FC<PartnerFlagProps> = ({
}) => {
return (
<Box sx={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>
<CircleFlag countryCode={countryIdentifier.toLowerCase()} height="20" />
<CircleFlag countryCode={countryIdentifier?.toLowerCase()} height="20" />
<Typography variant="caption" sx={{ color: theme => theme.palette.card.text }}>
{countryName}
</Typography>
Expand Down
62 changes: 42 additions & 20 deletions src/components/Partners/PartnersFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { ActionType, StatePartnersType, partnersActions } from '../../helpers/partnersReducer'

import { Box, Button, Checkbox, FormControlLabel, Typography } from '@mui/material'
import React from 'react'
import React, { useMemo } from 'react'
import store from 'wallet/store'
import { REGISTER_PARTNER_URL } from '../../constants/route-paths'
import { useAppSelector } from '../../hooks/reduxHooks'
import { useIsPartnerQuery } from '../../redux/services/partners'
import { getActiveNetwork } from '../../redux/slices/network'
import BusinessFieldFilter from './BusinessFieldFilter'
import SearchInput from './SearchInput'

Expand All @@ -14,6 +18,22 @@ interface PartnersFilterProps {
const PartnersFilter: React.FC<PartnersFilterProps> = ({ state, dispatchPartnersActions }) => {
const searchByName = param =>
dispatchPartnersActions({ type: partnersActions.UPDATE_COMPANY_NAME, payload: param })

const activeNetwork = useAppSelector(getActiveNetwork)
const { data } = useIsPartnerQuery({
cChainAddress: store?.state?.activeWallet?.ethAddress
? '0x' + store?.state?.activeWallet?.ethAddress
: '',
})
const partnerCChainAddress = useMemo(() => {
let cAddress = data?.attributes?.cChainAddresses.find(
elem => elem.Network === activeNetwork?.name?.toLowerCase(),
)
if (cAddress) return cAddress
return ''
}, [data])
const auth = useAppSelector(state => state.appConfig.isAuth)

return (
<Box
sx={{
Expand Down Expand Up @@ -76,28 +96,30 @@ const PartnersFilter: React.FC<PartnersFilterProps> = ({ state, dispatchPartners
/>
</Box>
</Box>
<Box
sx={{
flex: '1',
display: 'flex',
justifyContent: 'flex-end',
alignItems: 'flex-start',
}}
>
<Button
variant="contained"
component="a"
href={REGISTER_PARTNER_URL}
target="_blank"
rel="noopener noreferrer"
{(!auth || !partnerCChainAddress) && (
<Box
sx={{
whiteSpace: 'nowrap',
minWidth: 'max-content',
flex: '1',
display: 'flex',
justifyContent: 'flex-end',
alignItems: 'flex-start',
}}
>
Register as Partner
</Button>
</Box>
<Button
variant="contained"
component="a"
href={REGISTER_PARTNER_URL}
target="_blank"
rel="noopener noreferrer"
sx={{
whiteSpace: 'nowrap',
minWidth: 'max-content',
}}
>
Register as Partner
</Button>
</Box>
)}
</Box>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Partners/UpdatedSelectComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const UpdatedSelectComponent = React.memo(
)}
filterOptions={(options, { inputValue }) =>
options.filter(option =>
option.toLowerCase().includes(inputValue.toLowerCase()),
option?.toLowerCase().includes(inputValue.toLowerCase()),
)
}
groupBy={option => option.split('.')[2]}
Expand Down
17 changes: 17 additions & 0 deletions src/constants/apps-consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,23 @@ export const BUSINESS_FIELDS = [
'Climate Technology',
]

export const ERC20_ABI = [
'function name() view returns (string)',
'function symbol() view returns (string)',
'function decimals() view returns (uint8)',
'function totalSupply() view returns (uint256)',
'function balanceOf(address) view returns (uint256)',
]
export const ERC20_BALANCE_ABI = [
{
constant: true,
inputs: [{ name: '_owner', type: 'address' }],
name: 'balanceOf',
outputs: [{ name: 'balance', type: 'uint256' }],
type: 'function',
},
]

export const CONTRACTCMACCOUNTMANAGERADDRESSCOLUMBUS = '0xE5B2f76C778D082b07BDd7D51FFe83E3E055B47F'

export const CONTRACTCMACCOUNTMANAGERADDRESSCAMINO = '0xf9FE1eaAB73a2902136FE7A83E0703338D3b9F1e'
Loading
Loading