Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UBER-442,-452: Fixed login/signup layout, link, mention and backtick. #3408

Merged
merged 2 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion packages/presentation/src/components/message/Nodes.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
code {
padding: 0 0.25rem;
font-family: var(--mono-font);
color: var(--theme-link-color);
color: var(--theme-content-color);
background-color: var(--theme-button-enabled);
border: 1px solid var(--theme-button-border);
border-radius: 0.25rem;
Expand Down
3 changes: 1 addition & 2 deletions packages/text-editor/src/Completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ export const Completion = Node.create<CompletionOptions>({
mergeAttributes(
{
'data-type': this.name,
class: 'antiButton secondary cursor-pointer',
style: 'width: fit-content;display: inline-flex;'
class: 'antiMention'
},
this.options.HTMLAttributes,
HTMLAttributes
Expand Down
4 changes: 3 additions & 1 deletion packages/theme/styles/_colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,15 @@
--theme-comp-header-color: #1F1F2C;
--theme-divider-color: rgba(255, 255, 255, .06);
--theme-bg-divider-color: #282834;
--theme-mention-bg-color: rgba(55, 122, 230, 0.1);

--theme-trans-color: rgba(255, 255, 255, .3);
--theme-darker-color: rgba(255, 255, 255, .4);
--theme-halfcontent-color: rgba(255, 255, 255, .5);
--theme-dark-color: rgba(255, 255, 255, .6);
--theme-content-color: rgba(255, 255, 255, .8);
--theme-caption-color: #FFF;
--theme-link-color: #EB7861;
--theme-link-color: #377AE6;

--theme-list-border-color: rgba(255, 255, 255, .05);
--theme-list-header-color: #C88C65;
Expand Down Expand Up @@ -293,6 +294,7 @@
--theme-comp-header-color: #FBFBFC;
--theme-divider-color: rgba(0, 0, 0, .06);
--theme-bg-divider-color: #E3E3E5;
--theme-mention-bg-color: rgba(55, 122, 230, 0.1);

--theme-trans-color: rgba(0, 0, 0, .3);
--theme-darker-color: rgba(0, 0, 0, .4);
Expand Down
10 changes: 10 additions & 0 deletions packages/theme/styles/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,16 @@
}
}

.antiMention {
display: inline-flex;
padding: 0 .25rem;
width: fit-content;
color: var(--theme-link-color);
background-color: var(--theme-mention-bg-color);
border-radius: .25rem;
cursor: pointer;
}

.antiDivider {
margin: .25rem 0;
min-height: 1px;
Expand Down
3 changes: 2 additions & 1 deletion packages/theme/styles/prose.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@ table.proseTable {
.proseCode {
padding: 0 .25rem;
font-family: var(--mono-font);
color: var(--theme-link-color);
color: var(--theme-content-color);
background-color: var(--theme-button-enabled);
border: 1px solid var(--theme-button-border);
border-radius: .25rem;
}

.proseCodeBlock {
font-family: var(--mono-font);
color: var(--theme-content-color);
background-color: var(--theme-button-enabled);
border: 1px solid var(--theme-button-border);
border-radius: .25rem;
Expand Down
2 changes: 1 addition & 1 deletion plugins/login-assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"IncorrectValue": "Incorrect value {field}. {descr}"
},
"string": {
"LogIn": "Login",
"LogIn": "Log In",
"SignUp": "Sign Up",
"CreateWorkspace": "Create workspace",
"HaveWorkspace": "Already have a workspace?",
Expand Down
172 changes: 113 additions & 59 deletions plugins/login-resources/src/components/Form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@
// limitations under the License.
-->
<script lang="ts">
import { StylishEdit, Label, Button, Scroller, deviceOptionsStore as deviceInfo } from '@hcengineering/ui'
import {
getCurrentLocation,
navigate,
StylishEdit,
Label,
Button,
deviceOptionsStore as deviceInfo
} from '@hcengineering/ui'
import StatusControl from './StatusControl.svelte'
import { OK, Status, Severity } from '@hcengineering/platform'
import type { IntlString } from '@hcengineering/platform'
Expand Down Expand Up @@ -107,62 +114,95 @@
function trim (field: string): void {
object[field] = (object[field] as string).trim()
}

const goTab = (path: string) => {
const loc = getCurrentLocation()
loc.path[1] = path
loc.path.length = 2
navigate(loc)
}
$: loginState = caption === login.string.LogIn ? 'login' : caption === login.string.SignUp ? 'signup' : 'none'
</script>

<form class="container" style:padding={$deviceInfo.docWidth <= 480 ? '.25rem 1.25rem' : '4rem 5rem'}>
<div class="grow-separator" />
<div class="title"><Label label={caption} /></div>
<form
class="container"
style:padding={$deviceInfo.docWidth <= 480 ? '.25rem 1.25rem' : '4rem 5rem'}
style:min-height={$deviceInfo.docHeight > 720 ? '42rem' : '0'}
>
{#if loginState !== 'none'}
<div class="flex-row-center caption">
<a
class="title"
class:selected={loginState === 'signup'}
href="."
on:click|preventDefault={() => {
if (loginState !== 'signup') goTab('signup')
}}
>
<Label label={login.string.SignUp} />
</a>
<a
class="title"
class:selected={loginState === 'login'}
href="."
on:click|preventDefault={() => {
if (loginState !== 'login') goTab('login')
}}
>
<Label label={login.string.LogIn} />
</a>
</div>
{:else}
<div class="title"><Label label={caption} /></div>
{/if}
<div class="status">
<StatusControl {status} />
</div>
<Scroller padding={'.125rem 0'}>
<div class="form">
{#each fields as field (field.name)}
<div class={field.short && !($deviceInfo.docWidth <= 600) ? 'form-col' : 'form-row'}>
<StylishEdit
label={field.i18n}
name={field.id}
password={field.password}
bind:value={object[field.name]}
on:input={validate}
on:blur={() => {
trim(field.name)
}}
/>
</div>
{/each}
<div class="form">
{#each fields as field (field.name)}
<div class={field.short && !($deviceInfo.docWidth <= 600) ? 'form-col' : 'form-row'}>
<StylishEdit
label={field.i18n}
name={field.id}
password={field.password}
bind:value={object[field.name]}
on:input={validate}
on:blur={() => {
trim(field.name)
}}
/>
</div>
{/each}

<div class="form-row send">
<div class="form-row send">
<Button
label={action.i18n}
kind={'contrast'}
shape={'round2'}
size={'x-large'}
width="100%"
loading={inAction}
disabled={status.severity !== Severity.OK && status.severity !== Severity.ERROR}
on:click={(e) => {
e.preventDefault()
performAction(action)
}}
/>
</div>
{#if secondaryButtonLabel && secondaryButtonAction}
<div class="form-row">
<Button
label={action.i18n}
kind={'contrast'}
shape={'round2'}
size={'x-large'}
label={secondaryButtonLabel}
width="100%"
loading={inAction}
disabled={status.severity !== Severity.OK && status.severity !== Severity.ERROR}
on:click={(e) => {
e.preventDefault()
performAction(action)
secondaryButtonAction?.()
}}
/>
</div>
{#if secondaryButtonLabel && secondaryButtonAction}
<div class="form-row">
<Button
label={secondaryButtonLabel}
width="100%"
on:click={(e) => {
e.preventDefault()
secondaryButtonAction?.()
}}
/>
</div>
{/if}
</div>
</Scroller>
{/if}
</div>
{#if bottomActions.length}
<div class="grow-separator" />
<div class="footer">
{#each bottomActions as action}
<div>
Expand All @@ -179,17 +219,34 @@
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: space-between;
// width: 100%;
// flex-grow: 1;
// height: 100%;
// padding: 5rem;

.title {
font-weight: 600;
font-size: 1.5rem;
font-weight: 500;
font-size: 1.25rem;
color: var(--theme-caption-color);
}
.caption a {
padding-bottom: 0.375rem;
border-bottom: 2px solid var(--theme-caption-color);

&:not(.selected) {
color: var(--theme-dark-color);
border-bottom-color: transparent;

&:hover {
color: var(--theme-caption-color);
}
}
&.selected {
cursor: default;
}
&:first-child {
margin-right: 1.75rem;
}
&:hover {
text-decoration: none;
}
}
.status {
min-height: 7.5rem;
max-height: 7.5rem;
Expand All @@ -214,19 +271,16 @@
flex-grow: 1;
}
.footer {
margin-top: 3.5rem;
margin-top: 1.75rem;
font-size: 0.8rem;
color: var(--theme-caption-color);
color: var(--theme-content-color);
span {
opacity: 0.8;
color: var(--theme-darker-color);
}
a {
text-decoration: none;
color: var(--theme-caption-color);
opacity: 0.8;
&:hover {
opacity: 1;
}
font-weight: 500;
text-decoration: underline;
color: var(--theme-content-color);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/login-resources/src/components/LoginApp.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
background: rgba(45, 50, 160, 0.5);

.panel-base {
padding-top: 4rem;
padding-top: 5rem;
padding-bottom: 1rem;
width: 100%;
}
Expand Down
13 changes: 1 addition & 12 deletions plugins/login-resources/src/components/LoginForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,6 @@
navigate(loc)
}
}

const signUpAction = {
caption: login.string.DoNotHaveAnAccount,
i18n: login.string.SignUp,
func: () => {
const loc = getCurrentLocation()
loc.path[1] = 'signup'
loc.path.length = 2
navigate(loc)
}
}
</script>

<Form
Expand All @@ -114,6 +103,6 @@
{fields}
{object}
{action}
bottomActions={[signUpAction, recoveryAction]}
bottomActions={[recoveryAction]}
ignoreInitialValidation
/>
20 changes: 1 addition & 19 deletions plugins/login-resources/src/components/SignupForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,4 @@
}
</script>

<Form
caption={login.string.SignUp}
{status}
{fields}
{object}
{action}
bottomActions={[
{
caption: login.string.HaveAccount,
i18n: login.string.LogIn,
func: () => {
const loc = getCurrentLocation()
loc.path[1] = 'login'
loc.path.length = 2
navigate(loc)
}
}
]}
/>
<Form caption={login.string.SignUp} {status} {fields} {object} {action} />