import React, { useState, useEffect } from 'react' const ActionPerformer = ({ actionHook, LoadingButton, SuccessButton, ErrorButton, errorCallback, completeCallback }) => { // Call our useFetch() hook to start performing our action (i.e. importing a template) const { loading, data, error } = actionHook() // Check if we've successfully completed out action: if (!loading && !error) { // We've successfully imported the template, bubble up a success call after a short timeout // so we can show an "imported" state on the button briefly: setTimeout(() => { completeCallback(data) }, 500) return SuccessButton } // Check if we had an error performing the action: if (error) { setTimeout(() => { errorCallback(data) }, 100) return ErrorButton } // The default state of this component is loading, so we show that loading button here.. return LoadingButton } /** * Generic user action provider. * Used for things like "Import Template" and "Import Photo" buttons * * @param DefaultButton * @param CompletedButton * @param ProcessingButton * @param isAlreadyCompleted * @param completedCallback * @param actionConfirmationMessage * * @returns {*} * @constructor */ const ButtonActionProvider = ({ DefaultButton, CompletedButton, LoadingButton, ErrorButton, SuccessButton, actionHook, isAlreadyCompleted = false, completedCallback = null, errorCallback = null, actionConfirmationMessage = null }) => { const [isProcessing, setIsProcessing] = useState(false) const [isCompleted, setIsCompleted] = useState(isAlreadyCompleted) const [error, setError] = useState(null) useEffect(() => { if (isCompleted && completedCallback && !isAlreadyCompleted) { // We fire off an optional completed callback, if the component didn't start in the completed state. completedCallback(isCompleted) } }, [isCompleted]) useEffect(() => { if (error && errorCallback) { // We fire off an optional error callback, with the error data set below errorCallback(error) } }, [error]) useEffect(() => { // If our parent component resets our completed status prop, we update our local state to reflect this: setIsCompleted(isAlreadyCompleted) }, [isAlreadyCompleted]) // Check if this action has been completed: if (isCompleted) { return CompletedButton } // Check if we're currently performing the action: if (isProcessing) { // As soon as this "Processing" component renders we expect the ajax action to start running. // We provide a "completeCallback" that this "Processing" component can call once it's done it's thing. return ( { // If our action returns an error, we swap back to our default state so the user can try again setTimeout(() => { setIsProcessing(false) }, 500) setError(data) }} completeCallback={(data) => { setIsProcessing(false) setIsCompleted(data) }} /> ) } // Default state is not processing/completed, so we show a default button return React.cloneElement(DefaultButton, { onClick: (event) => { if (actionConfirmationMessage) { if (!confirm(actionConfirmationMessage)) { // user has denied the confirmation dialog, prevent calling our processing action. event.preventDefault() return false } } setIsProcessing(true) } }) } export default ButtonActionProvider TranslationSUB - Your bridge to the world
TranslationSUB

What We Do

Languages

English
Japanese
Portuguese

How it Works

STEP

Contact Us

Contact Us

Any questions? Feel free to ask us anything.

STEP

Get a Quote

Get a Quote

Fill up the form and our team will get back to you within 24 hours with a personalized quote to your project.

STEP

Confirm Order

Confirm order

If you agree with our price and delivery time, place your order by e-mail.

STEP

Payment

Payment

Payment methods: bank transfer, credit/debit card, PayPal and Wise.

※Depending on your country, limitations may apply. Please, consult us.

STEP

Work

Work

Our team will work on your project.

STEP

Delivery

We will deliver your project by e-mail. (Downloadable file)

STEP

Contact Us

Contact Us

Any questions? Feel free to ask us anything.

STEP

Get a Quote

Get a Quote

Fill up the form and our team will get back to you within 24 hours with a personalized quote to your project.

STEP

Confirm Order

Confirm order

If you agree with our price and delivery time, you can place your order by e-mail.

STEP

Payment

Payment

Payment methods: bank transfer, credit/debit card, PayPal and Wise.

※Depending on your country, limitations may apply. Please, consult us.

STEP

Work

Work

Our team will work on your project.

STEP

Delivery

We will deliver your project by e-mail. (Downloadable file)

Our Pricing

English to Japanese
¥ 6,600~
1 Page (300 words)
English to Portuguese
¥ 10,500~
1 Page (300 words)
Japanese to English
¥ 8,400~
1 Page (400 Characters)
Japanese to Portuguese
¥ 14,000~
1 Page (400 Characters)
Portuguese to English
¥ 9,600~
1 Page (300 words)
Portuguese to Japanese
¥ 9,900~
1 Page (300 words)

What Our Clients Say

"I will definitely come back again!"

I needed flyers and a business card. Not only they wrote and designed everything, I also had everything delivered to my door. I’m a foreigner in Japan and didn’t even know from where to start. Super recommended!!

Karina’Services

Business owner

“Super recomendado”

Eu já precisei de traduções para algumas trocas de e-mail de trabalho, tradução para dar entrada em papéis pra visto e até revisão do meu TCC. Sempre respondem em tempo hábil e o tratamento ao cliente é impecável.

hajimeme.edit

Editor de vídeo

“いつもお世話になっています!”

字幕で視聴者を増やす作戦に!動画に英語、日本語、ポルトガル語の字幕をいつも作ってもらっています。個人からの依頼を受け付ける会社が中々珍しくて、トラサブさんを見つけて助かりました(笑)。いつも丁度な対応もしてもらって、おすすめです。

Gaijin Honne - Burahon Channel

YouTuber

Reach out so we can work together to drive more customers to your products and services through our multilingual language support

Reach out so we can work together to drive more customers to your products and services through our multilingual language support