Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions components/AppHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@
</span>
<span class="nav-button__label">Energy</span>
</nuxt-link>
<nuxt-link v-if="activeDomain"
style="width: 30px; height: 30px; margin-left: 12px; padding: 6px;"
to="/domains/">
<nuxt-img
:alt="activeDomain.name"
:src="activeDomain.logo"
/>
</nuxt-link>
<button
:class="[isPopupOpen && 'nav-button--open']"
aria-label="Navigation button"
Expand Down Expand Up @@ -147,6 +155,9 @@ export default {
}
},
computed: {
activeDomain() {
return this.$store.getters['app/activeDomain']
},
isAuth() {
return this.$store.state.app.isAuth
},
Expand Down
28 changes: 17 additions & 11 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {Configuration as WebpackConfiguration} from 'webpack'
import {NuxtOptionsLoaders, NuxtWebpackEnv} from '@nuxt/types/config/build'
import { Configuration as WebpackConfiguration } from 'webpack'
import { NuxtOptionsLoaders, NuxtWebpackEnv } from '@nuxt/types/config/build'

const DOTENV_PATH =
process.env.NODE_ENV === 'production' ? '.env.production' : '.env.development'
require('dotenv').config({path: DOTENV_PATH})
require('dotenv').config({ path: DOTENV_PATH })

const title = 'Discover & grow your Aura...'
const description = 'Your Aura represents power & influence upon the Auracle.'
Expand All @@ -21,15 +21,15 @@ export default {
head: {
title,
meta: [
{charset: 'utf-8'},
{name: 'viewport', content: 'width=device-width, initial-scale=1'},
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{
hid: 'description',
name: 'description',
content: description,
},

{name: 'twitter:card', content: 'summary_large_image'},
{ name: 'twitter:card', content: 'summary_large_image' },
{
name: 'twitter:title',
content: title,
Expand Down Expand Up @@ -61,10 +61,10 @@ export default {
name: 'og:title',
content: description,
},
{hid: 'theme-color', name: 'theme-color', content: '#333333'},
{ hid: 'theme-color', name: 'theme-color', content: '#333333' },
],
link: [
{rel: 'icon', type: 'image/x-icon', href: '/favicon.ico'},
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{
rel: 'dns-prefetch',
href: 'https://fonts.gstatic.com/',
Expand All @@ -84,7 +84,13 @@ export default {
css: ['@/styles/index.scss'],

// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: ['~/plugins/api'],
plugins: [
'~/plugins/api',
{
src: '~/plugins/initClient',
mode: 'client',
},
],

// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
Expand All @@ -101,7 +107,7 @@ export default {
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
// https://go.nuxtjs.dev/pwa
['@nuxtjs/dotenv', {filename: DOTENV_PATH}],
['@nuxtjs/dotenv', { filename: DOTENV_PATH }],
'@nuxtjs/pwa',
'@nuxtjs/axios',
'@nuxtjs/date-fns',
Expand All @@ -116,7 +122,7 @@ export default {
'/brightid': {
target: 'https://recovery.brightid.org',
changeOrigin: true,
pathRewrite: {'^/brightid': '/'},
pathRewrite: { '^/brightid': '/' },
},
},

Expand Down
2 changes: 1 addition & 1 deletion pages/contact-us.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<section class="contact-us app-page">
<div class="container contact-us__wrapper">
<div class="container">
<h3 class="contact-us__title">Contact Us</h3>
<div class="contact-us__body">
<div class="contact-us__link-with-icon">
Expand Down
49 changes: 49 additions & 0 deletions pages/domains.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<template>
<section class="app-page">
<div class="container">
<h3 class="domains__title">Domains</h3>
<div class="domains__body">
<div v-for="domain in DOMAINS" :key="domain.id" class="domains__domain" @click="setActiveDomainId(domain.id)">
<div class="domains__domain__header__container">
<h4>{{ domain.name }}</h4>
<div
style="width: 40px; height: 40px; border-radius: 50%; padding: 6px; margin-left: 6px;">
<nuxt-img
:alt="domain.name"
:src="domain.logo"
/>
</div>
</div>
{{ domain.description }}
</div>
</div>
</div>
</section>
</template>

<script>
import {DOMAINS} from "~/utils/constants";

export default {
data() {
return {
DOMAINS
}
},
computed: {
loading() {
return this.$store.state.app.loading
}
},
methods: {
setActiveDomainId(domainId) {
this.$store.commit('app/setActiveDomainId', domainId)
if (this.$store.getters["app/isFirstVisitedRoute"]) {
this.$router.push('/connections/')
} else {
this.$router.go(-1)
}
}
}
}
</script>
9 changes: 9 additions & 0 deletions plugins/initClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Plugin } from '@nuxt/types'

const initClient: Plugin = ({ store }) => {
const localStorageDomainId = localStorage.getItem('activeDomainId')
if (localStorageDomainId) {
store.commit('app/setActiveDomainId', localStorageDomainId)
}
}
export default initClient
Binary file added static/images/brightid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/gitcoin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 12 additions & 3 deletions store/app.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {GetterTree, MutationTree} from 'vuex'
import {AppState, RootState} from '~/types/store'
import { GetterTree, MutationTree } from 'vuex'
import { AppState, RootState } from '~/types/store'
import { DomainId, DOMAINS } from '~/utils/constants'

export const state = (): AppState => ({
activeDomainId: DomainId.BRIGHTID,
hasUnsavedChanges: false,
loading: false,
isWebp: false,
Expand All @@ -14,10 +16,17 @@ export const state = (): AppState => ({
export const getters: GetterTree<AppState, RootState> = {
isFirstVisitedRoute: state => state.isFirstVisitedRoute,
searchValue: state => state.searchValue,
disableGlobalSearchResults: state => state.disableGlobalSearchResults
activeDomain: state => DOMAINS.find(d => d.id === state.activeDomainId),
disableGlobalSearchResults: state => state.disableGlobalSearchResults,
}

export const mutations: MutationTree<AppState> = {
setActiveDomainId(state, value) {
state.activeDomainId = value
if (process.client) {
localStorage.setItem('activeDomainId', value)
}
},
setHasUnsavedChanges(state, value) {
state.hasUnsavedChanges = value
},
Expand Down
2 changes: 1 addition & 1 deletion styles/components/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
align-items: center;
gap: 4px;
background-color: transparent;
margin-left: 24px;
margin-left: 12px;

&__label {
padding-left: 5px;
Expand Down
1 change: 1 addition & 0 deletions styles/pages/all.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@import './connections.scss';
@import './energy.scss';
@import './contact-us.scss';
@import './domains.scss';

.app-page {
margin-top: 110px;
Expand Down
1 change: 1 addition & 0 deletions styles/pages/contact-us.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
line-height: 130%;
letter-spacing: -0.03em;
color: var(--b-gray);
padding-top: 10px;
margin-bottom: 48px;
}

Expand Down
47 changes: 47 additions & 0 deletions styles/pages/domains.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.domains {
&__body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}

&__title {
@include semi;
display: flex;
justify-content: center;
align-items: flex-start;
font-size: 24px;
line-height: 130%;
letter-spacing: -0.03em;
color: var(--b-gray);
padding-top: 10px;
margin-bottom: 12px;
}

&__domain {
&__header {
&__container {
display: flex;
align-items: center
}
}

@include med;
margin-top: 30px;
font-size: 16px;
line-height: 150%;
background: linear-gradient(
90deg,
#ffffff 0.53%,
rgba(255, 255, 255, 0.5) 145.92%
);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
text-align: start;
border: 1px solid #777777;
padding: 15px;
cursor: pointer;
border-radius: 5px;
}
}
9 changes: 9 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// TODO: add typescript eslint to fix linter problems
// TODO: update values
import { DomainId } from '~/utils/constants'

export type ConnectionLevel =
| 'reported'
| 'suspicious'
Expand Down Expand Up @@ -149,3 +151,10 @@ export type BrightIdConnectionsResponse = {
connections: BrightIdConnection[]
}
}

export type EnergyDomain = {
id: DomainId
name: string
logo: string
description: string
}
2 changes: 2 additions & 0 deletions types/store.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import {
InboundEnergyAllocationList,
LocalForageBrightIdBackup,
} from '~/types/index'
import { DomainId } from '~/utils/constants'

export type RootState = {}
export type BrightIdData = any // TODO: determine the type
export type LoginState = {
isAuth: boolean
}
export type AppState = {
activeDomainId: DomainId
disableGlobalSearchResults: boolean
searchValue: string
hasUnsavedChanges: boolean
Expand Down
25 changes: 23 additions & 2 deletions utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ConnectionLevel} from '~/types'
import { ConnectionLevel, EnergyDomain } from '~/types'

export const CONNECTION_SEARCH_SEED = 5

Expand All @@ -18,10 +18,31 @@ export const IS_PRODUCTION =
(process.env.NUXT_ENV_VERCEL_ENV || process.env.NODE_ENV) === 'production'
export const brightIdBaseURL = 'http://184.72.224.75'


export const RATING_INBOUND_STAT = 'ri'
export const RATING_OUTBOUND_STAT = 'ro'
export const ENERGY_INBOUND_STAT = 'ei'
export const ENERGY_OUTBOUND_STAT = 'eo'

export const MUTUAL_CONNECTIONS_TEST_NAMESPACE = 'mutual-connections-'

export enum DomainId {
BRIGHTID = 'brightid',
GITCOIN = 'gitcoin',
}

export const DOMAINS: EnergyDomain[] = [
{
id: DomainId.BRIGHTID,
name: 'BrightID',
logo: '/images/brightid.png',
description:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
},
{
id: DomainId.GITCOIN,
name: 'Gitcoin',
logo: '/images/gitcoin.png',
description:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
},
]