diff --git a/src/components/profile/Profile.intl.json b/src/components/profile/Profile.intl.json index e4639cc..19f1e69 100644 --- a/src/components/profile/Profile.intl.json +++ b/src/components/profile/Profile.intl.json @@ -3,7 +3,8 @@ "personalData": "Personal data", "accountDescription": "Ely.by account allows you to get access to many Minecraft resources. Please, take care of your account safety. Use secure password and change it regularly.", "preferencesDescription": "Here you can change the key preferences of your account. Please note that all actions must be confirmed by entering a password.", - "mojangPriorityWarning": "A Mojang account with the same nickname was found. According to project rules, account owner has the right to demand the restoration of control over nickname.", + "mojangPriorityWarning": "A Mojang account with the same nickname was found. According to {rules}, account owner has the right to demand the restoration of control over nickname.", + "projectRules": "project rules", "oldHashingAlgoWarning": "Your was hashed with an old hashing algorithm.
Please, change password.", "changedAt": "Changed {at}", "disabled": "Disabled", diff --git a/src/components/profile/Profile.jsx b/src/components/profile/Profile.jsx index a979fea..817917a 100644 --- a/src/components/profile/Profile.jsx +++ b/src/components/profile/Profile.jsx @@ -1,6 +1,7 @@ import React, { Component } from 'react'; import { FormattedMessage as Message, FormattedRelative as Relative, FormattedHTMLMessage as HTMLMessage } from 'react-intl'; +import { Link } from 'react-router'; import Helmet from 'react-helmet'; import { userShape } from 'components/user/User'; @@ -12,6 +13,8 @@ import styles from './profile.scss'; import profileForm from './profileForm.scss'; import messages from './Profile.intl.json'; +import RulesPage from 'pages/rules/RulesPage'; + export default class Profile extends Component { static displayName = 'Profile'; static propTypes = { @@ -55,7 +58,16 @@ export default class Profile extends Component { label={} value={user.username} warningMessage={user.hasMojangUsernameCollision ? ( - + + + + ) + }} /> ) : ''} /> diff --git a/src/components/profile/profile.scss b/src/components/profile/profile.scss index f1fb5c4..38e3c0b 100644 --- a/src/components/profile/profile.scss +++ b/src/components/profile/profile.scss @@ -95,6 +95,16 @@ $formColumnWidth: 416px; color: $red; font-size: 11px; line-height: 1.2; + + a { + color: $red; + border-bottom: 1px dashed transparent; + transition: .25s; + + &:hover { + border-bottom-color: lighter($red); + } + } } .uuid { diff --git a/src/i18n/en.json b/src/i18n/en.json index b2d00a9..fb28eed 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -104,7 +104,7 @@ "components.profile.changeUsername.changeUsernameWarning": "Be careful: if you playing on the server with nickname binding, then after changing nickname you may lose all your progress.", "components.profile.changedAt": "Changed {at}", "components.profile.disabled": "Disabled", - "components.profile.mojangPriorityWarning": "A Mojang account with the same nickname was found. According to project rules, account owner has the right to demand the restoration of control over nickname.", + "components.profile.mojangPriorityWarning": "A Mojang account with the same nickname was found. According to {rules}, account owner has the right to demand the restoration of control over nickname.", "components.profile.nickname": "Nickname", "components.profile.oldHashingAlgoWarning": "Your was hashed with an old hashing algorithm.
Please, change password.", "components.profile.password": "Password", @@ -112,6 +112,7 @@ "components.profile.passwordRequestForm.title": "Confirm your action", "components.profile.personalData": "Personal data", "components.profile.preferencesDescription": "Here you can change the key preferences of your account. Please note that all actions must be confirmed by entering a password.", + "components.profile.projectRules": "project rules", "components.profile.twoFactorAuth": "Two factor auth", "components.userbar.logout": "Logout", "components.userbar.register": "Join", @@ -134,6 +135,7 @@ "pages.rules.mainProvision3": "Ely.by is side project, that has nothing to do with Mojang and Microsoft companies. We don't provide support to Minecraft premium accounts, and we have nothing to do with servers that use or don't use our services.", "pages.rules.mainProvision4": "The registration of the users account at server is free. Account creation Ely.by is only possible at that page {link}.", "pages.rules.mainProvisions": "Main provisions", + "pages.rules.title": "Site rules", "services.accountAlreadyActivated": "This account is already activated", "services.accountNotActivated": "The account is not activated", "services.doYouWantRequestKey": "Do you want to request a new key?", diff --git a/src/i18n/ru.json b/src/i18n/ru.json index 5db4948..ad75201 100644 --- a/src/i18n/ru.json +++ b/src/i18n/ru.json @@ -104,7 +104,7 @@ "components.profile.changeUsername.changeUsernameWarning": "Будьте внимательны: если вы играли на сервере с привязкой по нику, то после смены ника вы можете утратить весь свой прогресс.", "components.profile.changedAt": "Изменен {at}", "components.profile.disabled": "Не включена", - "components.profile.mojangPriorityWarning": "Найден аккаунт Mojang с таким же ником и, по правилам проекта, его владелец вправе потребовать восстановления контроля над ником.", + "components.profile.mojangPriorityWarning": "Найден аккаунт Mojang с таким же ником и, по {rules}, его владелец вправе потребовать восстановления контроля над ником.", "components.profile.nickname": "Ник", "components.profile.oldHashingAlgoWarning": "Для пароля применяется старый алгоритм хэширования
Пожалуйста, смените пароль.", "components.profile.password": "Пароль", @@ -112,6 +112,7 @@ "components.profile.passwordRequestForm.title": "Confirm your action", "components.profile.personalData": "Персональные данные", "components.profile.preferencesDescription": "Здесь вы можете сменить ключевые параметры вашего аккаунта. Обратите внимание, что для всех действий необходимо подтверждение при помощи ввода пароля.", + "components.profile.projectRules": "правилам проекта", "components.profile.twoFactorAuth": "Двухфакторная аутентификация", "components.userbar.logout": "Выход", "components.userbar.register": "Регистрация", @@ -134,6 +135,7 @@ "pages.rules.mainProvision3": "Ely.by является сторонней разработкой, не имеющей никакого отношения к компаниям Mojang и Microsoft. Мы не оказываем поддержки по премиум аккаунтам Minecraft, а также никак не связаны с игровыми серверами, использующими или не использующими наши сервисы.", "pages.rules.mainProvision4": "Регистрация пользовательского аккаунта на сервисе бесплатна. Создание аккаунта Ely.by возможно только на странице {link}.", "pages.rules.mainProvisions": "Основные положения", + "pages.rules.title": "Правила сайта", "services.accountAlreadyActivated": "Этот аккаунт уже активирован", "services.accountNotActivated": "Аккаунт не активирован", "services.doYouWantRequestKey": "Не хотите отправить новый код?", diff --git a/src/pages/rules/RulesPage.intl.json b/src/pages/rules/RulesPage.intl.json index b5c49ab..47938d6 100644 --- a/src/pages/rules/RulesPage.intl.json +++ b/src/pages/rules/RulesPage.intl.json @@ -1,4 +1,6 @@ { + "title" : "Site rules", + "mainProvisions": "Main provisions", "mainProvision1": "{name} service was created for the organization of safety access to Ely.by's users accounts, his partners and any side project that wish to use one of the our's services", "mainProvision2": "We (here and in the next points) - Ely.by project developers team that make creating qualitative services for Minecraft community.", diff --git a/src/pages/rules/RulesPage.jsx b/src/pages/rules/RulesPage.jsx index bcfa491..a5e85c3 100644 --- a/src/pages/rules/RulesPage.jsx +++ b/src/pages/rules/RulesPage.jsx @@ -1,7 +1,8 @@ -import React from 'react'; +import React, { Component, PropTypes } from 'react'; import { Link } from 'react-router'; import { FormattedMessage as Message } from 'react-intl'; +import Helmet from 'react-helmet'; import { FooterMenu } from 'components/footerMenu'; @@ -12,30 +13,32 @@ import appInfo from 'components/auth/appInfo/AppInfo.intl.json'; const projectName = ; +import classNames from 'classnames'; + const rules = [ { title: , items: [ - ({projectName}) - }} />), - (), - (), - (, + , + , + https://account.ely.by/register) - }} />) + }} /> ] }, { title: , items: [ - (), - (), - (), - (), - (), - (), - () + , + , + , + , + , + , + ] }, { @@ -49,44 +52,97 @@ const rules = [

), items: [ - (), - () + , + ] } ]; -export default function RulesPage() { - return ( -
-
- {rules.map((block, sectionIndex) => ( -
- -

{block.title}

+export default class RulesPage extends Component { + static propTypes = { + location: PropTypes.shape({ + hash: PropTypes.string + }) + }; -
- {block.description ? ( -
- {block.description} -
- ) : ''} -
    - {block.items.map((item, ruleIndex) => ( -
  1. - - {item} -
  2. - ))} -
+ static contextTypes = { + router: PropTypes.shape({ + createLocation: PropTypes.func.required, + replace: PropTypes.func.required + }).isRequired + }; + + render() { + let {hash} = this.props.location; + if (hash) { + hash = hash.substring(1); + } + + return ( +
+ + {(pageTitle) => ( + + )} + + +
+ {rules.map((block, sectionIndex) => ( +
+

+ {block.title} +

+ +
+ {block.description ? ( +
+ {block.description} +
+ ) : ''} +
    + {block.items.map((item, ruleIndex) => ( +
  1. + {item} +
  2. + ))} +
+
-
- ))} + ))} +
+
+ +
-
- -
-
- ); + ); + } + + onRuleClick(event) { + const {id} = event.currentTarget; + const {router} = this.context; + const newLocation = router.createLocation({...location, hash: `#${id}`}); + router.replace(newLocation); + } + + static getTitleHash(sectionIndex) { + return `rule-${sectionIndex + 1}`; + } + + static getRuleHash(sectionIndex, ruleIndex) { + return `${RulesPage.getTitleHash(sectionIndex)}-${ruleIndex + 1}`; + } } RulesPage.displayName = 'RulesPage'; diff --git a/src/pages/rules/rules.scss b/src/pages/rules/rules.scss index 5bcb342..cf2e72f 100644 --- a/src/pages/rules/rules.scss +++ b/src/pages/rules/rules.scss @@ -25,6 +25,10 @@ } .rulesBody { + position: relative; + // z-index, чтобы положить :before ниже текста, но выше фона блока + z-index: 0; + padding: 20px; background: #fff; font-size: 14px; @@ -53,20 +57,40 @@ @extend %rulesTextFormat; list-style: decimal; + position: relative; + cursor: pointer; &:last-of-type { margin-bottom: 0; } + &.target { + &:before { + cursor: default; + $border: 8px solid #ddd8ce; + content: ''; + position: absolute; + top: -10px; + left: -40px; + width: calc(100% + 60px); + height: calc(100% + 20px); + background: $light; + border-left: $border; + border-right: $border; + box-sizing: border-box; + z-index: -1; + } + } + a { color: #444; border-bottom: 1px dotted #aaa; text-decoration: none; - transition: .25s - } + transition: .25s; - a:hover { - border-bottom-color: #444 + &:hover { + border-bottom-color: #444 + } } }