Added snackbars to subscription and copy link in the share popup
This commit is contained in:
parent
15e57950fe
commit
6871b1a146
|
@ -52,6 +52,7 @@
|
||||||
"Cooperate": "Cooperate",
|
"Cooperate": "Cooperate",
|
||||||
"Copy": "Copy",
|
"Copy": "Copy",
|
||||||
"Copy link": "Copy link",
|
"Copy link": "Copy link",
|
||||||
|
"Link copied": "Link copied",
|
||||||
"Corrections history": "Corrections history",
|
"Corrections history": "Corrections history",
|
||||||
"Create Chat": "Create Chat",
|
"Create Chat": "Create Chat",
|
||||||
"Create Group": "Create a group",
|
"Create Group": "Create a group",
|
||||||
|
@ -245,6 +246,7 @@
|
||||||
"Terms of use": "Site rules",
|
"Terms of use": "Site rules",
|
||||||
"Text checking": "Text checking",
|
"Text checking": "Text checking",
|
||||||
"Thank you": "Thank you",
|
"Thank you": "Thank you",
|
||||||
|
"Thank you for subscribing": "Thank you for subscribing",
|
||||||
"This comment has not yet been rated": "This comment has not yet been rated",
|
"This comment has not yet been rated": "This comment has not yet been rated",
|
||||||
"This email is already taken. If it's you": "This email is already taken. If it's you",
|
"This email is already taken. If it's you": "This email is already taken. If it's you",
|
||||||
"This functionality is currently not available, we would like to work on this issue. Use the download link.": "This functionality is currently not available, we would like to work on this issue. Use the download link.",
|
"This functionality is currently not available, we would like to work on this issue. Use the download link.": "This functionality is currently not available, we would like to work on this issue. Use the download link.",
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
"Cooperate": "Соучаствовать",
|
"Cooperate": "Соучаствовать",
|
||||||
"Copy": "Скопировать",
|
"Copy": "Скопировать",
|
||||||
"Copy link": "Скопировать ссылку",
|
"Copy link": "Скопировать ссылку",
|
||||||
|
"Link copied": "Ссылка скопирована",
|
||||||
"Corrections history": "История правок",
|
"Corrections history": "История правок",
|
||||||
"Create Chat": "Создать чат",
|
"Create Chat": "Создать чат",
|
||||||
"Create Group": "Создать группу",
|
"Create Group": "Создать группу",
|
||||||
|
@ -259,6 +260,7 @@
|
||||||
"Terms of use": "Правила сайта",
|
"Terms of use": "Правила сайта",
|
||||||
"Text checking": "Проверка текста",
|
"Text checking": "Проверка текста",
|
||||||
"Thank you": "Благодарности",
|
"Thank you": "Благодарности",
|
||||||
|
"Thank you for subscribing": "Спасибо, что подписались на рассылку",
|
||||||
"This comment has not yet been rated": "Этот комментарий еще пока никто не оценил",
|
"This comment has not yet been rated": "Этот комментарий еще пока никто не оценил",
|
||||||
"This email is already taken. If it's you": "Такой email уже зарегистрирован. Если это вы",
|
"This email is already taken. If it's you": "Такой email уже зарегистрирован. Если это вы",
|
||||||
"This functionality is currently not available, we would like to work on this issue. Use the download link.": "В данный момент этот функционал недоступен, мы работаем над этой проблемой. Воспользуйтесь загрузкой по ссылке.",
|
"This functionality is currently not available, we would like to work on this issue. Use the download link.": "В данный момент этот функционал недоступен, мы работаем над этой проблемой. Воспользуйтесь загрузкой по ссылке.",
|
||||||
|
|
|
@ -6,6 +6,7 @@ import type { PopupProps } from '../_shared/Popup'
|
||||||
import { Popup } from '../_shared/Popup'
|
import { Popup } from '../_shared/Popup'
|
||||||
import { useLocalize } from '../../context/localize'
|
import { useLocalize } from '../../context/localize'
|
||||||
import { createEffect, createSignal } from 'solid-js'
|
import { createEffect, createSignal } from 'solid-js'
|
||||||
|
import { useSnackbar } from '../../context/snackbar'
|
||||||
|
|
||||||
type SharePopupProps = {
|
type SharePopupProps = {
|
||||||
title: string
|
title: string
|
||||||
|
@ -24,6 +25,9 @@ export const getShareUrl = (params: { pathname?: string } = {}) => {
|
||||||
export const SharePopup = (props: SharePopupProps) => {
|
export const SharePopup = (props: SharePopupProps) => {
|
||||||
const { t } = useLocalize()
|
const { t } = useLocalize()
|
||||||
const [isVisible, setIsVisible] = createSignal(false)
|
const [isVisible, setIsVisible] = createSignal(false)
|
||||||
|
const {
|
||||||
|
actions: { showSnackbar }
|
||||||
|
} = useSnackbar()
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
if (props.isVisible) {
|
if (props.isVisible) {
|
||||||
|
@ -36,8 +40,10 @@ export const SharePopup = (props: SharePopupProps) => {
|
||||||
url: props.shareUrl,
|
url: props.shareUrl,
|
||||||
description: props.description
|
description: props.description
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const copyLink = async () => {
|
const copyLink = async () => {
|
||||||
await navigator.clipboard.writeText(props.shareUrl)
|
await navigator.clipboard.writeText(props.shareUrl)
|
||||||
|
showSnackbar({ body: t('Link copied') })
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { isValidEmail } from '../../utils/validators'
|
||||||
import { Button } from '../_shared/Button'
|
import { Button } from '../_shared/Button'
|
||||||
|
|
||||||
import styles from './Subscribe.module.scss'
|
import styles from './Subscribe.module.scss'
|
||||||
|
import { useSnackbar } from '../../context/snackbar'
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const { t } = useLocalize()
|
const { t } = useLocalize()
|
||||||
|
@ -12,6 +13,9 @@ export default () => {
|
||||||
const [title, setTitle] = createSignal('')
|
const [title, setTitle] = createSignal('')
|
||||||
const [email, setEmail] = createSignal('')
|
const [email, setEmail] = createSignal('')
|
||||||
const [emailError, setEmailError] = createSignal<string>(null)
|
const [emailError, setEmailError] = createSignal<string>(null)
|
||||||
|
const {
|
||||||
|
actions: { showSnackbar }
|
||||||
|
} = useSnackbar()
|
||||||
|
|
||||||
const validate = (): boolean => {
|
const validate = (): boolean => {
|
||||||
if (!email()) {
|
if (!email()) {
|
||||||
|
@ -52,6 +56,7 @@ export default () => {
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
setTitle(t('You are subscribed'))
|
setTitle(t('You are subscribed'))
|
||||||
|
showSnackbar({ body: t('Thank you for subscribing') })
|
||||||
} else {
|
} else {
|
||||||
if (response.status === 400) {
|
if (response.status === 400) {
|
||||||
setEmailError(t('Please check your email address'))
|
setEmailError(t('Please check your email address'))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user