Skip to content

Commit

Permalink
upd design
Browse files Browse the repository at this point in the history
  • Loading branch information
lukachi committed May 17, 2024
1 parent f08a0a0 commit eeb980f
Show file tree
Hide file tree
Showing 42 changed files with 383 additions and 347 deletions.
3 changes: 3 additions & 0 deletions .env-development
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ VITE_API_URL=https://api.stage.freedomtool.org
VITE_RPC_URL='https://rpc.qtestnet.org'
VITE_VOTING_REGISTRY_CONTRACT_ADDRESS=0xECB5371C727a664160c4F4360af77F0Fe4aeb7F9
VITE_VOTING_DEPLOYER_CONTRACT_ADDRESS=0xf41ceE234219D6cc3d90A6996dC3276aD378cfCF

VITE_APP_STORE_LINK=https://apps.apple.com/us/app/freedom-tool/id6477800949
VITE_APP_DOMAIN=
3 changes: 3 additions & 0 deletions .env-production
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ VITE_API_URL=https://api.stage.freedomtool.org
VITE_RPC_URL='https://rpc.qtestnet.org'
VITE_VOTING_REGISTRY_CONTRACT_ADDRESS=0xECB5371C727a664160c4F4360af77F0Fe4aeb7F9
VITE_VOTING_DEPLOYER_CONTRACT_ADDRESS=0xf41ceE234219D6cc3d90A6996dC3276aD378cfCF

VITE_APP_STORE_LINK=https://apps.apple.com/us/app/freedom-tool/id6477800949
VITE_APP_DOMAIN=
13 changes: 9 additions & 4 deletions env-example
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
VITE_MODE=development
VITE_PORT=8095

VITE_APP_NAME='Voting App'
VITE_API_URL=https://api.stage.freedomtool.org
VITE_VOTING_REGISTRY_CONTRACT_ADDRESS=0xba6ba925C97d5EeE410BdD8e7950653e22E3CE73
VITE_VOTING_DEPLOYER_CONTRACT_ADDRESS=0xcca19442F5b3e5Fa71aaE69C092aC280e81Fd39f
VITE_APP_NAME=
VITE_API_URL=

VITE_RPC_URL=
VITE_VOTING_REGISTRY_CONTRACT_ADDRESS=
VITE_VOTING_DEPLOYER_CONTRACT_ADDRESS=

VITE_APP_STORE_LINK=
VITE_APP_DOMAIN=
14 changes: 7 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<title>Freedomtool App</title>
<title>Freedomtool Voting App</title>

<noscript>
<style>
Expand All @@ -16,17 +16,17 @@
<meta name="theme-color" content="#ffffff">

<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0">
<meta name="description" content="Freedomtool App">
<meta property="og:title" content="Freedomtool App">
<meta property="og:description" content="Freedomtool App">
<meta name="description" content="Freedomtool Voting App">
<meta property="og:title" content="Freedomtool Voting App">
<meta property="og:description" content="Freedomtool Voting App">
<meta property="og:url" content="<%- host %>">
<meta property="og:image" content="<%- host %>/branding/og-img.png">
<meta property="og:locale" content="en_GB">
<meta property="og:type" content="website">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="<%- host %>/branding/og-img.png">
<meta name="twitter:title" content="Freedomtool App">
<meta name="twitter:description" content="Freedomtool App">
<meta name="twitter:title" content="Freedomtool Voting App">
<meta name="twitter:description" content="Freedomtool Voting App">

<link rel="apple-touch-icon" sizes="180x180" href="/branding/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/branding/favicon-32x32.png">
Expand All @@ -47,7 +47,7 @@
<body>
<div id="root">
<div id="noscript" class="app__init">
<img src="/branding/logo.svg" alt="Freedomtool App logo" width="192">
<img src="/branding/logo.svg" alt="Freedomtool Voting App logo" width="192">
</div>
</div>
<div id="modal"></div>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "voting-app",
"version": "0.1.0",
"description": "Freedom voting",
"description": "Freedomtool Voting App",
"author": "Zero Block Global Foundation",
"license": "MIT",
"private": true,
Expand Down
16 changes: 12 additions & 4 deletions src/common/LangSwitcher.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import { Button, ButtonProps } from '@mui/material'
import upperCase from 'lodash/upperCase'
import { useCallback } from 'react'
import { useTranslation } from 'react-i18next'

import { setDayjsLocal } from '@/helpers'
import { uiStore } from '@/store'
import { UiIcon } from '@/ui'

type Props = ButtonProps

export default function LangSwitcher({ ...rest }: Props) {
const { i18n } = useTranslation()
const { t, i18n } = useTranslation()

const switchLocale = useCallback(async () => {
const nextLang = i18n.language === 'en' ? 'ru' : 'en'
// TODO: change after adding new language
const nextLang = i18n.language === 'en' ? 'en' : 'en'
await i18n.changeLanguage(nextLang)
uiStore.setLocale(nextLang)

setDayjsLocal(i18n.language)
}, [i18n])

return (
Expand All @@ -24,7 +27,12 @@ export default function LangSwitcher({ ...rest }: Props) {
startIcon={<UiIcon componentName='language' />}
onClick={switchLocale}
>
{upperCase(i18n.language)}
{
{
ru: t('lang-switcher.ru'),
en: t('lang-switcher.en'),
}[i18n.language]
}
</Button>
)
}
2 changes: 1 addition & 1 deletion src/common/NoDataViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface Props extends StackProps {

export default function NoDataViewer({
icon = <UiIcon componentName='folderOff' />,
title = 'No data',
title = '',
description,
action,
...rest
Expand Down
4 changes: 4 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export type Config = {
RPC_URL: string
VOTING_REGISTRY_CONTRACT_ADDRESS: string
VOTING_DEPLOYER_CONTRACT_ADDRESS: string

APP_STORE_LINK: string
}

export const config: Config = {
Expand All @@ -18,4 +20,6 @@ export const config: Config = {
RPC_URL: import.meta.env.VITE_RPC_URL,
VOTING_REGISTRY_CONTRACT_ADDRESS: import.meta.env.VITE_VOTING_REGISTRY_CONTRACT_ADDRESS,
VOTING_DEPLOYER_CONTRACT_ADDRESS: import.meta.env.VITE_VOTING_DEPLOYER_CONTRACT_ADDRESS,

APP_STORE_LINK: import.meta.env.VITE_APP_STORE_LINK,
}
17 changes: 14 additions & 3 deletions src/helpers/format.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
import { time, type TimeDate } from '@distributedlab/tools'
import { Time, time, type TimeDate } from '@distributedlab/tools'
import enDayjsLocal from 'dayjs/locale/en'
import ruDayjsLocal from 'dayjs/locale/ru'

const FORMATTED_DID_MAX_LENGTH = 12

export const setDayjsLocal = (locale: string) => {
const nextLocale = {
ru: ruDayjsLocal,
en: enDayjsLocal,
}[locale]

Time.locale(nextLocale)
}

export function formatDid(did: string) {
return did.length > FORMATTED_DID_MAX_LENGTH ? did.slice(0, 8) + '...' + did.slice(-4) : did
}

export function formatDateDMY(date: TimeDate) {
return time(date).format('DD MMM YYYY')
return new Time(date).format('DD MMM YYYY')
}

export function formatDateDMYT(date: TimeDate) {
return time(date).format('DD MMM YYYY HH:mm')
return new Time(date).format('DD MMM YYYY HH:mm')
}

export function formatDateDiff(dateEnd: TimeDate) {
Expand Down
6 changes: 1 addition & 5 deletions src/hooks/translate.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { useTranslation } from 'react-i18next'

import { useUiState } from '@/store'

export const useTranslate = () => {
const { locale } = useUiState()

const { t, ...rest } = useTranslation(locale)
const { t, ...rest } = useTranslation()

return {
t,
Expand Down
3 changes: 3 additions & 0 deletions src/locales/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { use } from 'i18next'
import { initReactI18next } from 'react-i18next'

import { setDayjsLocal } from '@/helpers'
import { uiStore } from '@/store'

import resources from './resources'
Expand All @@ -9,6 +10,8 @@ const DEFAULT_LOCALE = 'en'

const locale = uiStore.locale ?? DEFAULT_LOCALE

setDayjsLocal(locale)

declare module 'i18next' {
interface CustomTypeOptions {
returnNull: false
Expand Down
6 changes: 0 additions & 6 deletions src/locales/resources.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import en from './resources/en.json'
import ru from './resources/ru.json'

const resources = {
en: {
translation: {
...en,
},
},
ru: {
translation: {
...ru,
},
},
}

export default resources
Expand Down
72 changes: 57 additions & 15 deletions src/locales/resources/en.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
{
"profile-page": {
"title" : "Profiles & Wallets",
"description": "Manage your identity credentials and Soulbound Tokens (SBTs) easily from this app",
"wallet": "Wallet",
"filter": "Filter",
"empty-title": "Add Credentials",
"empty-description": "Explore credentials marketplace with different providers "
},
"sign-in-page": {
"title": "Sign in",
"description": "Manage your identity credentials and Soulbound Tokens (SBTs) easily from this app",
"connect-btn": "Connect Metamask",
"install-btn": "Install Metamask",
"reload-page-btn": "Please, reload page"
},
"validations": {
"field-error_required": "Please fill out this field",
"field-error_minLength": "This field must contain minimum {{minLength}} symbols",
Expand Down Expand Up @@ -41,5 +26,62 @@
"voting-start-timer": "Voting starts {{startTime}}",
"voting-end-timer": "Voting ends {{endTime}}",
"voting-ended": "Voting has ended"
},
"votings-id": {
"error-msg": "An error occurred, please reload the page",
"empty-title": "No votings found",
"empty-btn": "See all votings",
"back-btn": "Back"
},
"voting-registration-end": {
"registered-users": "people supported",
"registered-users_zero": "people supported",
"registered-users_one": "human supported",
"registered-users_two": "people supported",
"registered-users_few": "people supported",
"registered-users_many": "people supported",
"registered-users_other": "people supported"
},
"voting-registration": {
"success-msg": "You have successfully supported the manifesto",
"status-prefix": "Your status:",
"status-allowed": "You can participate",
"condition-1": "You have condition 1",
"condition-2": "You have condition 2",
"registered-alert": "You have already supported the manifesto",
"register-btn": "Support",
"request-modal-title": "Authenticate via Freedomtool app"
},
"app-request-modal": {
"qr-desc": "Scan the code in the app"
},
"voting-alive": {
"request-modal-title": "Authenticate via Freedomtool app",
"success-msg": "You have successfully voted",
"not-registered-msg": "You are not registered",
"select-section-lbl": "Select Answer",
"no-options-msg": "No candidates",
"confirm-btn": "CONFIRM"
},
"voting-before-registration": {
"soon-msg": "Signature collection will start soon"
},
"voting-process-modal": {
"step-1-title": "Formation of the signature",
"step-2-title": "Anonymization",
"step-3-title": "Sending your signature",
"step-4-title": "Finalization",
"wait-msg": "Success",
"sec-msg": "Your signature is accounted for",
"loading-status": "Wait...",
"done-status": "Done"
},
"votings-list": {
"title": "Active petitions",
"error-msg": "An error occurred, please reload the page"
},
"lang-switcher": {
"ru": "Русский",
"en": "English"
}
}
29 changes: 0 additions & 29 deletions src/locales/resources/ru.json

This file was deleted.

Loading

0 comments on commit eeb980f

Please sign in to comment.