-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Google Translate document entries translate and add form helper e…
…verywhere
- Loading branch information
Showing
40 changed files
with
345 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
webapp/app/pods/components/inline-machine-translate/component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import Component from '@glimmer/component'; | ||
import {inject as service} from '@ember/service'; | ||
import {dropTask} from 'ember-concurrency-decorators'; | ||
import {taskFor} from 'ember-concurrency-ts'; | ||
import Apollo from 'accent-webapp/services/apollo'; | ||
|
||
import projectTranslateTextQuery from 'accent-webapp/queries/translate-text-project'; | ||
|
||
interface Args { | ||
text: string; | ||
sourceLanguageSlug: string; | ||
project: {id: string}; | ||
onUpdatingText: () => void; | ||
onUpdateText: (value: string) => void; | ||
} | ||
|
||
export default class ImprovePrompt extends Component<Args> { | ||
@service('apollo') | ||
apollo: Apollo; | ||
|
||
get isSubmitting() { | ||
return taskFor(this.submitTask).isRunning; | ||
} | ||
|
||
@dropTask | ||
*submitTask(targetLanguageSlug: string) { | ||
this.args.onUpdatingText(); | ||
|
||
const variables = { | ||
projectId: this.args.project.id, | ||
text: this.args.text, | ||
sourceLanguageSlug: this.args.sourceLanguageSlug, | ||
targetLanguageSlug, | ||
}; | ||
|
||
const {data} = yield this.apollo.client.query({ | ||
query: projectTranslateTextQuery, | ||
variables, | ||
}); | ||
|
||
if (data.viewer.project.translatedText?.text) { | ||
this.args.onUpdateText(data.viewer.project.translatedText?.text); | ||
} | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
webapp/app/pods/components/inline-machine-translate/styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
.prompt-button { | ||
position: relative; | ||
display: flex; | ||
align-items: center; | ||
|
||
> .button { | ||
transition: opacity 0.2s ease-in-out; | ||
box-shadow: none; | ||
opacity: 0.7; | ||
border-radius: var(--border-radius); | ||
} | ||
|
||
> button:focus, | ||
> button:hover { | ||
transform: translate3d(0, 0, 0); | ||
} | ||
|
||
&:focus, | ||
&:hover { | ||
outline: none; | ||
|
||
> .button { | ||
opacity: 1; | ||
} | ||
|
||
.prompt-button-quick-access[data-rtl] { | ||
left: 36px; | ||
right: auto; | ||
} | ||
|
||
.prompt-button-quick-access { | ||
opacity: 1; | ||
right: 36px; | ||
padding: 0 10px; | ||
pointer-events: all; | ||
} | ||
} | ||
} | ||
|
||
.prompt-button-quick-access[data-rtl] { | ||
left: 0; | ||
right: auto; | ||
justify-content: flex-start; | ||
} | ||
|
||
.prompt-button-quick-access { | ||
background: var(--input-background); | ||
opacity: 0; | ||
pointer-events: none; | ||
right: 0; | ||
display: flex; | ||
gap: 4px; | ||
justify-content: flex-end; | ||
align-items: center; | ||
position: absolute; | ||
top: 0; | ||
transition: all 0.2s ease-in-out; | ||
|
||
> button { | ||
font-size: 11px; | ||
flex-shrink: 0; | ||
font-weight: normal; | ||
} | ||
|
||
> button:focus, | ||
> button:hover { | ||
transform: translate3d(0, 0, 0); | ||
} | ||
|
||
> button :global(.label) { | ||
padding-left: 8px; | ||
padding-right: 8px; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
webapp/app/pods/components/inline-machine-translate/template.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{#if @languages}} | ||
<div local-class='prompt-button' tabindex='0'> | ||
<div local-class='prompt-button-quick-access' data-rtl={{@rtl}}> | ||
{{#each @languages as |language|}} | ||
<AsyncButton title={{language.name}} @onClick={{(perform this.submitTask language.slug)}} class='button button--iconOnly button--filled button--borderless button--white'> | ||
{{language.slug}} | ||
</AsyncButton> | ||
{{/each}} | ||
</div> | ||
|
||
<button local-class='button' class='button button--iconOnly button--borderless button--filled button--white'> | ||
{{inline-svg '/assets/language.svg' class='button-icon'}} | ||
</button> | ||
</div> | ||
{{/if}} |
Oops, something went wrong.