Skip to content

Commit

Permalink
Merge pull request rairprotocol#119 from rairprotocol/dev
Browse files Browse the repository at this point in the history
merge latest changes in dev to main branch
  • Loading branch information
RAIRprotocol authored Jul 17, 2024
2 parents 76cf748 + e17e523 commit a44ef2b
Show file tree
Hide file tree
Showing 86 changed files with 1,594 additions and 715 deletions.
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ base_mainnet_rpc=https://base-mainnet.g.alchemy.com/v2/LPVexfumI81FHrSqJyhwpZ9yb
#default image for NFTs that have no metadata
default_product_cover=https://rair.myfilebase.com/ipfs/QmcV94NurwfWVGpXTST1we8uDbYiVQamKe87WEHK6DRzqa
#ipfs configuration - pinata or ipfs
ipfs_service=pinata
ipfs_service=filebase
ipfs_gateway=http://rairipfs:8080/ipfs
ipfs_api=http://rairipfs:5001
#gcp storage configuration
Expand Down
4 changes: 2 additions & 2 deletions rair-front/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# build environment

FROM node:21.2.0 as build
FROM node:22.4.0 as build

WORKDIR /usr/src/minting

Expand All @@ -22,4 +22,4 @@ COPY --from=build /usr/src/minting/nginx/nginx.conf /etc/nginx/conf.d/default.co
EXPOSE 80

# The default parameters to ENTRYPOINT (unless overruled on the command line)
CMD ["nginx", "-g", "daemon off;"]
CMD ["nginx", "-g", "daemon off;"]
2 changes: 1 addition & 1 deletion rair-front/nginx/nginx.conf.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ server {
}

location /socket.io {
proxy_pass http://rair-stream:5002;
proxy_pass http://rair-node:5000;
client_max_body_size 200000M;
}
}
Expand Down
17 changes: 17 additions & 0 deletions rair-front/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ import ErrorFallback from './views/ErrorFallback/ErrorFallback';

import 'bootstrap/dist/css/bootstrap.min.css';
import './App.css';
import { rFetch } from './utils/rFetch';
/* Track a page view */
// const analytics = getInformationGoogleAnalytics();
// analytics.page();
Expand Down Expand Up @@ -133,6 +134,7 @@ function App() {
const [tabIndexItems, setTabIndexItems] = useState(0);
const [tokenNumber, setTokenNumber] = useState<number | undefined>(undefined);
const navigate = useNavigate();
const [notificationCount, setNotificationCount] = useState<number>(0);

// Redux
const { primaryColor, textColor, backgroundImage, backgroundImageEffect } =
Expand Down Expand Up @@ -194,6 +196,19 @@ function App() {
}
}, [dispatch, logoutUser]);

const getNotificationsCount = useCallback( async () => {
if (currentUserAddress) {
const result = await rFetch(`/api/notifications?onlyUnread=true`);
if (result.success && result.totalCount > 0) {
setNotificationCount(result.totalCount);
}
}
}, [currentUserAddress]);

useEffect(() => {
getNotificationsCount();
}, [getNotificationsCount])

// gtag

useEffect(() => {
Expand Down Expand Up @@ -367,6 +382,8 @@ function App() {
selectedChain={correctBlockchain(realChain)}
setTabIndexItems={setTabIndexItems}
isAboutPage={isAboutPage}
notificationCount={notificationCount}
getNotificationsCount={getNotificationsCount}
/>
)
)}
Expand Down
6 changes: 4 additions & 2 deletions rair-front/src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const Footer: React.FC<IFooter> = () => {

const hotdropsVar = import.meta.env.VITE_TESTNET;

const { headerLogo, primaryColor, textColor, primaryButtonColor } =
const { headerLogo, primaryColor, textColor, secondaryColor } =
useSelector<RootState, ColorStoreType>((store) => store.colorStore);

const onChangeEmail = (e) => {
Expand All @@ -52,7 +52,9 @@ const Footer: React.FC<IFooter> = () => {
<FooterMain
hotdrops={hotdropsVar}
primaryColor={primaryColor}
textColor={textColor}>
textColor={textColor}
secondaryColor={secondaryColor}
>
<FooterWrapper
className="footer-wrapper-hotdrops"
primaryColor={primaryColor}>
Expand Down
3 changes: 2 additions & 1 deletion rair-front/src/components/Footer/FooterItems/FooterItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ type TFooterMainStyled = {
messageAlert?: string;
hotdrops?: string;
textColor?: any;
secondaryColor?: string;
};

export const FooterMain = styled.footer<TFooterMainStyled>`
background: ${(props) =>
props.primaryColor === '#dedede'
? '#fff'
: `color-mix(in srgb, ${props.primaryColor}, #888888)`};
: `color-mix(in srgb, ${props.secondaryColor}, #888888)`};
padding: 40px 120px 25px 120px;
color: ${(props) => props.textColor};
Expand Down
56 changes: 49 additions & 7 deletions rair-front/src/components/Header/AdminPanel/AdminPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const AdminPanel = ({ creatorViewsDisabled, adminPanel, setAdminPanel }) => {
const { adminRights, loggedIn } = useSelector<RootState, TUsersInitialState>(
(store) => store.userStore
);
const { primaryColor, secondaryColor, textColor } = useSelector<
const { primaryColor, textColor, iconColor } = useSelector<
RootState,
ColorStoreType
>((store) => store.colorStore);
Expand All @@ -42,7 +42,14 @@ const AdminPanel = ({ creatorViewsDisabled, adminPanel, setAdminPanel }) => {
<TooltipBox position={'top'} title="Server Settings">
{' '}
<div>
<i className="fa fa-cog" aria-hidden="true" />
<i style={{
color:
import.meta.env.VITE_TESTNET === 'true'
?
`${iconColor === '#1486c5' ? '#F95631' : iconColor}`
: `${
iconColor === '#1486c5' ? '#E882D5' : iconColor}`
}} className="fa fa-cog" aria-hidden="true" />
</div>
</TooltipBox>
),
Expand All @@ -54,7 +61,14 @@ const AdminPanel = ({ creatorViewsDisabled, adminPanel, setAdminPanel }) => {
<TooltipBox position={'top'} title="License">
{' '}
<div>
<i className="fa fa-id-card" aria-hidden="true" />
<i style={{
color:
import.meta.env.VITE_TESTNET === 'true'
?
`${iconColor === '#1486c5' ? '#F95631' : iconColor}`
: `${
iconColor === '#1486c5' ? '#E882D5' : iconColor}`
}} className="fa fa-id-card" aria-hidden="true" />
</div>
</TooltipBox>
),
Expand All @@ -67,7 +81,14 @@ const AdminPanel = ({ creatorViewsDisabled, adminPanel, setAdminPanel }) => {
position={'top'}
title="Import / Export / Transfer">
<div>
<i className="fas fa-city" />
<i style={{
color:
import.meta.env.VITE_TESTNET === 'true'
?
`${iconColor === '#1486c5' ? '#F95631' : iconColor}`
: `${
iconColor === '#1486c5' ? '#E882D5' : iconColor}`
}} className="fas fa-city" />
</div>
</TooltipBox>
),
Expand All @@ -78,7 +99,14 @@ const AdminPanel = ({ creatorViewsDisabled, adminPanel, setAdminPanel }) => {
name: (
<TooltipBox position={'top'} title="Streaming">
<div style={{ width: '70px' }}>
<i className="fas fa-film" />
<i style={{
color:
import.meta.env.VITE_TESTNET === 'true'
?
`${iconColor === '#1486c5' ? '#F95631' : iconColor}`
: `${
iconColor === '#1486c5' ? '#E882D5' : iconColor}`
}} className="fas fa-film" />
</div>
</TooltipBox>
),
Expand All @@ -89,7 +117,14 @@ const AdminPanel = ({ creatorViewsDisabled, adminPanel, setAdminPanel }) => {
name: (
<TooltipBox position={'top'} title="Old Market (diamond)">
<div style={{ width: '70px' }}>
<i className="fas fa-gem" />
<i style={{
color:
import.meta.env.VITE_TESTNET === 'true'
?
`${iconColor === '#1486c5' ? '#F95631' : iconColor}`
: `${
iconColor === '#1486c5' ? '#E882D5' : iconColor}`
}} className="fas fa-gem" />
</div>
</TooltipBox>
),
Expand All @@ -100,7 +135,14 @@ const AdminPanel = ({ creatorViewsDisabled, adminPanel, setAdminPanel }) => {
name: (
<TooltipBox position={'top'} title="Old Market (classic)">
<div style={{ width: '70px' }}>
<i className="fa fa-shopping-cart" aria-hidden="true" />
<i style={{
color:
import.meta.env.VITE_TESTNET === 'true'
?
`${iconColor === '#1486c5' ? '#F95631' : iconColor}`
: `${
iconColor === '#1486c5' ? '#E882D5' : iconColor}`
}} className="fa fa-shopping-cart" aria-hidden="true" />
</div>
</TooltipBox>
),
Expand Down
3 changes: 2 additions & 1 deletion rair-front/src/components/Header/HeaderItems/HeaderItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ interface IHeaderContainerStyled {
isSplashPage?: boolean;
hotdrops?: string;
realChainId?: string | undefined;
secondaryColor?: string;
}

export const HeaderContainer = styled.div<IHeaderContainerStyled>`
background: ${(props) =>
props.primaryColor === '#dedede'
? '#fff'
: `color-mix(in srgb, ${props.primaryColor}, #888888)`};
: `color-mix(in srgb, ${props.secondaryColor}, #888888)`};
margin-top: ${(props) =>
props.realChainId &&
props.showAlert &&
Expand Down
53 changes: 41 additions & 12 deletions rair-front/src/components/Header/MainHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import TalkSalesComponent from './HeaderItems/TalkToSalesComponent/TalkSalesComp

//styles
import './Header.css';
import { rFetch } from '../../utils/rFetch';

const MainHeader: React.FC<IMainHeader> = ({
goHome,
Expand All @@ -54,7 +55,7 @@ const MainHeader: React.FC<IMainHeader> = ({

const { ref, isComponentVisible, setIsComponentVisible } =
useComponentVisible(true);
const { primaryColor, headerLogo, primaryButtonColor, textColor } =
const { primaryColor, headerLogo, primaryButtonColor, textColor, secondaryColor, iconColor } =
useSelector<RootState, ColorStoreType>((store) => store.colorStore);
const { connectUserData } = useConnectUser();
const { dataAll, message } = useSelector<RootState, TSearchInitialState>(
Expand All @@ -69,7 +70,11 @@ const MainHeader: React.FC<IMainHeader> = ({
(store) => store.contractStore
);

console.info(iconColor, 'iconColor')

const hotdropsVar = import.meta.env.VITE_TESTNET;
const [realDataNotification, setRealDataNotification] = useState([]);
const [notificationCount, setNotificationCount] = useState<number>(0);

const [textSearch, setTextSearch] = useState<string>('');
const [adminPanel, setAdminPanel] = useState<boolean>(false);
Expand Down Expand Up @@ -122,6 +127,35 @@ const MainHeader: React.FC<IMainHeader> = ({
setTextSearch('');
};

const getNotifications = useCallback(async (pageNum?: number) => {
if(currentUserAddress) {
// const result = await rFetch(`/api/notifications${itemsPerPage && pageNum ? `?itemsPerPage=${itemsPerPage}&pageNum=${pageNum}` : ''}`);
const result = await rFetch(`/api/notifications${`?pageNum=${Number(pageNum)}`}`);

if (result.success) {
setRealDataNotification(result.notifications);
}
}
}, [currentUserAddress]);

const getNotificationsCount = useCallback( async () => {
if(currentUserAddress) {
const result = await rFetch(`/api/notifications?onlyUnread=true`);
if (result.success && result.totalCount > 0) {
setNotificationCount(result.totalCount);
}
}
}, [currentUserAddress])

useEffect(() => {
getNotificationsCount();
}, [getNotificationsCount])


useEffect(() => {
getNotifications(0);
}, [currentUserAddress])

const Highlight = (props) => {
const { filter, str } = props;
if (!filter) return str;
Expand Down Expand Up @@ -173,6 +207,7 @@ const MainHeader: React.FC<IMainHeader> = ({
isSplashPage={isSplashPage}
selectedChain={selectedChain}
realChainId={realChainId}
secondaryColor={secondaryColor}
ref={ref}>
<div>
<MainLogo
Expand Down Expand Up @@ -206,7 +241,7 @@ const MainHeader: React.FC<IMainHeader> = ({
backgroundColor: primaryColor
}}
type="text"
placeholder="Search the rairverse..."
placeholder="Search..."
onChange={handleChangeText}
value={textSearch}
onClick={() => setIsComponentVisible(true)}
Expand Down Expand Up @@ -356,16 +391,10 @@ const MainHeader: React.FC<IMainHeader> = ({
style={{
color:
import.meta.env.VITE_TESTNET === 'true'
? `${
textColor === '#FFF' || textColor === 'black'
? '#F95631'
: textColor
}`
?
`${iconColor === '#1486c5' ? '#F95631' : iconColor}`
: `${
textColor === '#FFF' || textColor === 'black'
? '#E882D5'
: textColor
}`
iconColor === '#1486c5' ? '#E882D5' : iconColor}`
}}
aria-hidden="true"></i>
</div>
Expand Down Expand Up @@ -414,7 +443,7 @@ const MainHeader: React.FC<IMainHeader> = ({
isSplashPage={isSplashPage}
/>
<div className="social-media">
{currentUserAddress && <PopUpNotification />}
{currentUserAddress && <PopUpNotification setRealDataNotification={setRealDataNotification} notificationCount={notificationCount} getNotificationsCount={getNotificationsCount} getNotifications={getNotifications} realDataNotification={realDataNotification} />}

<AdminPanel
creatorViewsDisabled={creatorViewsDisabled}
Expand Down
Loading

0 comments on commit a44ef2b

Please sign in to comment.