Skip to content

Commit

Permalink
Merge branch 'develop' into wip/sections-flexbox-self
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-yudakov committed Feb 10, 2023
2 parents bf0e6f6 + 3fd71af commit d14d268
Show file tree
Hide file tree
Showing 101 changed files with 474 additions and 607 deletions.
28 changes: 15 additions & 13 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/.classpath
**/.dockerignore
**/.env
**/.eslint
**/.eslintcache
**/.git
**/.gitattributes
**/.github
**/.gitignore
**/.prettierrc
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
**/yarn-debug.log

# project specific
README.md
**/.gitattributes
**/.github
**/.git
manifests
**/.env.development*
**/.env.test*
**/build
**/dist

53 changes: 53 additions & 0 deletions .github/actions/build-plugin/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 'Odyssey UI plugin build action'
description: 'Composite action to build Odyssey UI plugin from monorepo.'
inputs:
plugin-name:
description: "Name of the plugin (the part after packages/plugin_)"
required: true
version:
description: "The version being build"
required: true
registry-server:
description: "Docker registry server"
required: true
registry-user:
description: "Docker registry authentication username"
required: true
registry-pass:
description: "Docker registry authentication password"
required: true
github-token:
description: "Github authentication token"
required: true
k8s-credentials:
description: "K8s credentials"
required: true
plugin-dir:
description: "Optional directory, if it is not the same as plugin-name"
required: false
deploy-name:
description: "Optional naming used for deployment, if it is not the same as plugin-name"
required: false
runs:
using: "composite"
steps:
- id: build-plugin
name: Build ${{ inputs.plugin-name }}
uses: momentum-xyz/[email protected]
with:
registry-server: ${{ inputs.registry-server }}
registry-user: ${{ inputs.registry-user }}
registry-pass: ${{ inputs.registry-pass }}
github-token: ${{ inputs.github-token }}
image-name: plugin-${{ inputs.plugin-name }}
multistage-target: plugin-runtime
extra-args: --build-arg PLUGIN=${{ inputs.plugin-dir || inputs.plugin-name }}
- id: deploy-dev
name: Deploy to development environment
if: github.ref == 'refs/heads/develop'
uses: momentum-xyz/deploy-action@v1
with:
project: plugin-${{ inputs.deploy-name || inputs.plugin-name }}
version: ${{ inputs.version }}
k8s-credentials: ${{ inputs.k8s-credentials }}

95 changes: 19 additions & 76 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: build-deploy

on:
workflow_dispatch:
push:
branches:
- develop
Expand Down Expand Up @@ -34,93 +35,35 @@ jobs:
with:
version: ${{ env.VERSION }}
k8s-credentials: ${{ secrets[secrets.REF_K8S_DEV2] }}
build-miro:
runs-on: self-hosted # ubuntu-latest
needs: build-app
steps:
- id: build-miro
uses: momentum-xyz/[email protected]
with:
registry-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
registry-user: ${{ secrets.REGISTRY_USERNAME }}
registry-pass: ${{ secrets.REGISTRY_PASSWORD }}
github-token: ${{ secrets.GITHUB_TOKEN }}
image-name: plugin-miro
multistage-target: plugin-runtime
extra-args: --build-arg PLUGIN=miro
outputs:
version: ${{ steps.build.outputs.version }}
dev2-deploy-miro:
runs-on: self-hosted
needs: build-miro
if: github.ref == 'refs/heads/develop'
concurrency: dev-deploy-${{ github.ref }}
steps:
- id: deploy-dev
uses: momentum-xyz/deploy-action@v1
with:
project: plugin-miro
version: ${{ env.VERSION }}
k8s-credentials: ${{ secrets[secrets.REF_K8S_DEV2] }}
build-gdrive:
runs-on: self-hosted # ubuntu-latest
needs: build-app
steps:
- id: build-gdrive
uses: momentum-xyz/[email protected]
with:
registry-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
registry-user: ${{ secrets.REGISTRY_USERNAME }}
registry-pass: ${{ secrets.REGISTRY_PASSWORD }}
github-token: ${{ secrets.GITHUB_TOKEN }}
image-name: plugin-gdrive
multistage-target: plugin-runtime
extra-args: --build-arg PLUGIN=google_drive
outputs:
version: ${{ steps.build.outputs.version }}
dev2-deploy-gdrive:
build-plugins:
runs-on: self-hosted
needs: build-gdrive
if: github.ref == 'refs/heads/develop'
concurrency: dev-deploy-${{ github.ref }}
steps:
- id: deploy-dev
uses: momentum-xyz/deploy-action@v1
with:
project: plugin-google-drive
version: ${{ env.VERSION }}
k8s-credentials: ${{ secrets[secrets.REF_K8S_DEV2] }}
build-video:
runs-on: self-hosted # ubuntu-latest
needs: build-app
strategy:
matrix:
plugin: ["miro", "gdrive", "video"]
include:
- plugin: gdrive
directory: google_drive
deploy: google-drive
steps:
- id: build-video
uses: momentum-xyz/[email protected]
- name: "Checkout"
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.0.3
- id: build-plugin
name: Build plugin
uses: ./.github/actions/build-plugin
with:
plugin-name: ${{ matrix.plugin }}
version: ${{ needs.build-app.outputs.version }}
registry-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
registry-user: ${{ secrets.REGISTRY_USERNAME }}
registry-pass: ${{ secrets.REGISTRY_PASSWORD }}
github-token: ${{ secrets.GITHUB_TOKEN }}
image-name: plugin-video
multistage-target: plugin-runtime
extra-args: --build-arg PLUGIN=video
outputs:
version: ${{ steps.build.outputs.version }}
dev2-deploy-video:
runs-on: self-hosted
needs: build-video
if: github.ref == 'refs/heads/develop'
concurrency: dev-deploy-${{ github.ref }}
steps:
- id: deploy-dev
uses: momentum-xyz/deploy-action@v1
with:
project: plugin-video
version: ${{ env.VERSION }}
k8s-credentials: ${{ secrets[secrets.REF_K8S_DEV2] }}
plugin-dir: ${{ matrix.directory }}
deploy-name: ${{ matrix.deploy }}
ops-deploy:
runs-on: ubuntu-latest
needs: [build-app, build-miro, build-gdrive, build-video]
needs: [build-app, build-plugins]
if: ${{ startsWith(github.ref, 'refs/tags/') }}
env:
PROJECT_NAME: ${{ github.event.repository.name }}
Expand Down
3 changes: 2 additions & 1 deletion packages/app/src/api/constants/app.variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ export const appVariables: AppConfigExtendedInterface = {
STREAMCHAT_KEY: '',
NFT_ADMIN_ADDRESS: '',
NFT_COLLECTION_ODYSSEY_ID: '',
NODE_ID: ''
NODE_ID: '',
ODYSSEY_WORLD_ID: 'b8b104c4-b375-4933-8de8-29e0a1c67860'
};

const {REACT_APP_OVERRIDE_CONFIG_VARIABLES = '{}'} = process.env;
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/api/interfaces/appConfig.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ export interface AppConfigExtendedInterface extends AppConfigInterface {
PARTICIPANTS_VIDEO_LIMIT: number;
MAX_STAGE_USERS: number;
GAT_UI_TYPE_ID: string;
ODYSSEY_WORLD_ID: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ export interface ResolveNodeRequest {
}

export interface ResolveNodeResponse {
domain: string;
url: string;
node_id: string;
}
13 changes: 13 additions & 0 deletions packages/app/src/core/interfaces/common/route.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,16 @@ export interface RouteConfigInterface {
exact?: boolean;
main: () => JSX.Element | null;
}

export interface ProtectedRouteInterface {
path: string;
exact?: boolean;
defaultRedirect?: string;
hasRights?: () => boolean;
}

export interface ProtectedRouteListInterface {
routes: RouteConfigInterface[];
defaultRedirect?: string;
hasRights?: () => boolean;
}
2 changes: 1 addition & 1 deletion packages/app/src/core/types/unityEvent.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type UnityEventType = {
HideMinimap: () => void;
InvalidToken: () => void;
ExterminateUnity: (topic: string) => void;
ClickObjectEvent: (id: string) => void;
ClickObjectEvent: (id: string, label: string) => void;
EditObjectEvent: (id: string) => void;
ProfileClickEvent: (id: string, position: UnityPositionInterface) => void;
Error: (message: string) => void;
Expand Down
39 changes: 25 additions & 14 deletions packages/app/src/core/utils/router.utils.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, {ReactElement} from 'react';
import {matchPath, Redirect, Route, Switch} from 'react-router-dom';
import {matchPath, Redirect, Switch} from 'react-router-dom';
import {SwitchProps} from 'react-router';

import {RouteConfigInterface} from 'core/interfaces';
import {ProtectedRoute} from 'ui-kit';
import {ProtectedRouteListInterface, RouteConfigInterface} from 'core/interfaces';

export const isTargetRoute = (currentPath: string, routes: RouteConfigInterface[]): boolean => {
return routes.some((route) => {
Expand All @@ -11,21 +12,31 @@ export const isTargetRoute = (currentPath: string, routes: RouteConfigInterface[
};

export const createRoutesByConfig = (
routes: RouteConfigInterface[]
config: ProtectedRouteListInterface
): ReactElement<string, any>[] => {
return routes.map(({path, exact, ...rest}) => (
<Route key={path} path={path} exact={exact}>
<rest.main />
</Route>
const {routes, defaultRedirect, hasRights} = config;

return routes.map((route) => (
<ProtectedRoute
key={route.path}
{...route}
hasRights={hasRights}
defaultRedirect={defaultRedirect}
>
<route.main />
</ProtectedRoute>
));
};

export const createSwitchByConfig = (
routes: RouteConfigInterface[],
defaultRedirect?: string
): ReactElement<SwitchProps, any> => (
<Switch>
{createRoutesByConfig(routes)}
{defaultRedirect && <Redirect to={defaultRedirect} />}
</Switch>
);
defaultRedirect?: string,
hasRights?: () => boolean
): ReactElement<SwitchProps, any> => {
return (
<Switch>
{createRoutesByConfig({routes, defaultRedirect, hasRights})}
{defaultRedirect && <Redirect to={defaultRedirect} />}
</Switch>
);
};
6 changes: 2 additions & 4 deletions packages/app/src/scenes/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ import 'react-toastify/dist/ReactToastify.css';

const App: FC = () => {
const rootStore = useStore();
const {configStore, sessionStore, themeStore, unityStore, sentryStore} = rootStore;
const {configStore, sessionStore, themeStore, sentryStore} = rootStore;
const {configLoadingErrorCode} = configStore;
const {unityInstanceStore} = unityStore;

const {pathname} = useLocation<{pathname: string}>();
const history = useHistory();
Expand All @@ -42,9 +41,8 @@ const App: FC = () => {
if (configStore.isConfigReady) {
sessionStore.init();
sentryStore.init();
unityInstanceStore.init();
}
}, [sessionStore, configStore.isConfigReady, unityInstanceStore, sentryStore]);
}, [sessionStore, configStore.isConfigReady, sentryStore]);

const isBrowserUnsupported = !isBrowserSupported();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {useTranslation} from 'react-i18next';
import {Button, Heading, IconSvg, Text} from '@momentum-xyz/ui-kit';

import {Box} from 'ui-kit';
import image from 'static/images/world.svg';
import image from 'static/images/world.jpg';

import * as styled from './CreateOdyssey.styled';

Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/scenes/map3d/pages/Map3dPage/Map3dPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ const Map3dPage: FC<PropsInterface> = ({isClickActive}) => {
[isClickActive, nftStore, odysseyInfoStore, previewOdysseyStore, sessionStore]
);

if (nftStore.isLoading) {
if (nftStore.isLoading || !sessionStore.map3dUser) {
return <></>;
}

return (
<Map3dCanvas
centerWallet={sessionStore.wallet}
currentUser={sessionStore.map3dUser}
selectedUuid={odysseyInfoStore.nftId}
items={nftStore.nftItems}
getConnections={nftStore.getStakedAtOthersByWallet}
Expand Down
Loading

0 comments on commit d14d268

Please sign in to comment.