Home / File/ progress-rtl.tsx — ui Source File

progress-rtl.tsx — ui Source File

Architecture documentation for progress-rtl.tsx, a tsx file in the ui codebase. 3 imports, 0 dependents.

File tsx DocumentationAtlas SearchAPI 3 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  21a31d62_27c1_c2a5_de83_88380cbc2f51["progress-rtl.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  21a31d62_27c1_c2a5_de83_88380cbc2f51 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  242b398c_a9af_94b9_24c0_d6e89fbeef48["progress"]
  21a31d62_27c1_c2a5_de83_88380cbc2f51 --> 242b398c_a9af_94b9_24c0_d6e89fbeef48
  2c1404ab_bf28_6225_f9a0_b9e29400c66c["language-selector"]
  21a31d62_27c1_c2a5_de83_88380cbc2f51 --> 2c1404ab_bf28_6225_f9a0_b9e29400c66c
  style 21a31d62_27c1_c2a5_de83_88380cbc2f51 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import {
  Progress,
  ProgressLabel,
  ProgressValue,
} from "@/examples/base/ui-rtl/progress"

import {
  useTranslation,
  type Translations,
} from "@/components/language-selector"

const translations: Translations = {
  en: {
    dir: "ltr",
    values: {
      label: "Upload progress",
    },
  },
  ar: {
    dir: "rtl",
    values: {
      label: "تقدم الرفع",
    },
  },
  he: {
    dir: "rtl",
    values: {
      label: "התקדמות העלאה",
    },
  },
}

function toArabicNumerals(num: number): string {
  const arabicNumerals = ["٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩"]
  return num
    .toString()
    .split("")
    .map((digit) => arabicNumerals[parseInt(digit, 10)])
    .join("")
}

export function ProgressRtl() {
  const { dir, t, language } = useTranslation(translations, "ar")

  const formatNumber = (num: number): string => {
    if (language === "ar") {
      return toArabicNumerals(num)
    }
    return num.toString()
  }

  return (
    <Progress value={56} className="w-full max-w-sm" dir={dir}>
      <ProgressLabel>{t.label}</ProgressLabel>
      <ProgressValue>
        {(value) => (
          <span className="ms-auto">
            {formatNumber(parseFloat(value ?? "0"))}%
          </span>
        )}
      </ProgressValue>
    </Progress>
  )
}

Subdomains

Dependencies

  • language-selector
  • progress
  • react

Frequently Asked Questions

What does progress-rtl.tsx do?
progress-rtl.tsx is a source file in the ui codebase, written in tsx. It belongs to the DocumentationAtlas domain, SearchAPI subdomain.
What functions are defined in progress-rtl.tsx?
progress-rtl.tsx defines 2 function(s): ProgressRtl, toArabicNumerals.
What does progress-rtl.tsx depend on?
progress-rtl.tsx imports 3 module(s): language-selector, progress, react.
Where is progress-rtl.tsx in the architecture?
progress-rtl.tsx is located at apps/v4/examples/base/progress-rtl.tsx (domain: DocumentationAtlas, subdomain: SearchAPI, directory: apps/v4/examples/base).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free