import { Lang } from "@/constants/languages"
import { webviews } from "@/constants/routes/webviews"

export function modWebviewLink(url: string, lang: Lang) {
  const urlWithoutLang = url.replace(`/${lang}`, "")

  const webviewUrl = `/${lang}/webview${urlWithoutLang}`
  if (webviews.includes(webviewUrl) || url.startsWith("/webview")) {
    return webviewUrl
  } else {
    return url
  }
}
