Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"pdfjs-dist": "4.10.38",
"pinia": "2.0.33",
"plyr": "3.7.8",
"reka-ui": "^2.9.9",
"socket.io-client": "4.7.2",
"typescript": "5.7.2",
"vue": "^3.5.27",
Expand Down
33 changes: 19 additions & 14 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
<template>
<FrappeUIProvider>
<Layout class="isolate text-p-base">
<router-view :route="background" />
</Layout>
<router-view v-if="background" />
<NotificationPanel />
<ContinueCoursePanel
v-if="canHaveDraft"
:user="userResource.data.name"
:besideHelp="helpPanelOpen"
/>
<InstallPrompt v-if="isMobile && !settings.data?.disable_pwa" />
<Dialogs />
</FrappeUIProvider>
<!-- Reka stamps dir="ltr" on tabs, radio groups and menus unless told. -->
<ConfigProvider :dir="textDirection()">
<FrappeUIProvider>
<Layout class="isolate text-p-base">
<router-view :route="background" />
</Layout>
<router-view v-if="background" />
<NotificationPanel />
<ContinueCoursePanel
v-if="canHaveDraft"
:user="userResource.data.name"
:besideHelp="helpPanelOpen"
/>
<InstallPrompt v-if="isMobile && !settings.data?.disable_pwa" />
<Dialogs />
</FrappeUIProvider>
</ConfigProvider>
</template>
<script setup>
import { FrappeUIProvider } from 'frappe-ui'
import { ConfigProvider } from 'reka-ui'
import { textDirection } from '@/utils/textDirection'
import { Dialogs } from '@/utils/dialogs'
import { computed } from 'vue'
import { useScreenSize } from './utils/composables'
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/components/AudioBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,15 @@ const formatTime = (time) => {
cursor: pointer;
}

/* A range input runs right to left in RTL; the played fill has to follow it. */
[dir='rtl'] .audio-seek {
background: linear-gradient(
to left,
var(--ink-gray-9) var(--played),
var(--surface-gray-4) var(--played)
);
}

.audio-seek::-webkit-slider-thumb {
-webkit-appearance: none;
width: 12px;
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/BlockEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { onBeforeUnmount, onMounted, ref } from 'vue'
import EditorJS from '@editorjs/editorjs'
import DragDrop from 'editorjs-drag-drop'
import { enablePlyr, getEditorTools, getEditorTunes } from '@/utils'
import { textDirection } from '@/utils/textDirection'

const props = defineProps({
uploadContext: {
Expand Down Expand Up @@ -80,7 +81,7 @@ onMounted(() => {
tunes: getEditorTunes(),
defaultBlock: 'markdown',
i18n: {
direction: document.documentElement.dir === 'rtl' ? 'rtl' : 'ltr',
direction: textDirection(),
},
onReady: () => {
// onReady can fire after the component unmounted (fast nav / deleting
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Controls/Link.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
:aria-label="__('Cancel')"
@click="creating = false"
>
<span class="lucide-arrow-left size-4" />
<span class="lucide-arrow-left size-4 rtl:rotate-180" />
</button>
<FormControl
v-model="newItemName"
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/Controls/VideoPreviewField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
:id="inputId"
type="text"
v-model="urlInput"
dir="auto"
:aria-label="__('YouTube link')"
:placeholder="__('Paste a YouTube link')"
variant="outline"
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/Courses/CourseThumbnailField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<div class="text-ink-gray-9 font-medium break-all leading-5">
{{ filename }}
<span
dir="ltr"
class="ms-2 inline-block whitespace-nowrap text-ink-gray-6 font-normal"
>
{{ metaLabel }}
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/DiscussionReplies.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
@click="showTopics = true"
>
<template #icon>
<span class="lucide-chevron-left size-5 text-ink-gray-7" />
<span
class="lucide-chevron-left size-5 text-ink-gray-7 rtl:rotate-180"
/>
</template>
</Button>
<span class="text-lg-semibold ms-2 text-ink-gray-9">
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/components/Enrollment/EnrollPaymentPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
v-if="showBack"
data-testid="payment-panel-back"
variant="ghost"
icon="lucide-chevron-left"
:aria-label="__('Back')"
@click="emit('back')"
/>
>
<template #icon>
<span class="lucide-chevron-left size-4 rtl:rotate-180" />
</template>
</Button>
<h3
data-testid="panel-title"
class="truncate text-base font-semibold text-ink-gray-9"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/InstallPrompt.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<Popover :open="iosInstallMessage" side="top" align="start" bare>
<template #default>
<div
class="fixed top-[20rem] translate-x-1/3 z-20 flex flex-col gap-3 rounded-4 bg-surface-base py-5 drop-shadow-xl"
class="fixed top-[20rem] translate-x-1/3 rtl:-translate-x-1/3 z-20 flex flex-col gap-3 rounded-4 bg-surface-base py-5 drop-shadow-xl"
>
<div
class="mb-1 flex flex-row items-center justify-between px-3 text-center"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Layouts/pages/PageHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:aria-label="__('Back')"
class="-ms-3 shrink-0 rounded-4 p-1.5 text-ink-gray-9 transition-colors hover:bg-surface-gray-2"
>
<span class="lucide-chevron-left size-4 block" />
<span class="lucide-chevron-left size-4 block rtl:rotate-180" />
</router-link>
<span class="min-w-0 truncate text-lg-medium text-ink-gray-9">
{{ currentLabel }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class="-ms-3 shrink-0 rounded-4 p-1.5 text-ink-gray-9 transition-colors hover:bg-surface-gray-2"
@click="emit('back')"
>
<span class="lucide-chevron-left size-4 block" />
<span class="lucide-chevron-left size-4 block rtl:rotate-180" />
</button>
<h1 class="min-w-0 flex-1 truncate text-lg-medium text-ink-gray-9">
{{ title }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
>
<CodeEditorContent
class="mt-1"
dir="ltr"
:style="{ '--code-max-height': height, minHeight: height }"
/>
</CodeEditor>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
v-if="showBack"
variant="ghost"
size="md"
icon-left="lucide-chevron-left"
:label="title"
class="-ms-3.5 !max-w-96 !justify-start !pe-0 text-p-lg-semibold cursor-pointer hover:bg-transparent hover:opacity-70 focus:bg-transparent active:bg-transparent active:text-ink-gray-6"
@click="emit('back')"
/>
>
<template #prefix>
<span class="lucide-chevron-left size-4.5 rtl:rotate-180" />
</template>
</Button>
<h2 v-else-if="title" class="text-p-lg-semibold text-ink-gray-8">
{{ title }}
</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
/>
<span
v-else-if="tag !== 'div' && chevron"
class="lucide-chevron-right size-4.5 shrink-0 text-ink-gray-5"
class="lucide-chevron-right size-4.5 shrink-0 text-ink-gray-5 rtl:rotate-180"
aria-hidden="true"
/>
</component>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/LessonNavButtons.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<Button v-if="hasPrev" @click="emit('switch', 'prev')">
<template #prefix>
<span class="lucide-chevron-left size-4" />
<span class="lucide-chevron-left size-4 rtl:rotate-180" />
</template>
<span>{{ __('Previous') }}</span>
</Button>
<Button v-if="hasNext" @click="emit('switch', 'next')">
<template #suffix>
<span class="lucide-chevron-right size-4" />
<span class="lucide-chevron-right size-4 rtl:rotate-180" />
</template>
<span>{{ __('Next') }}</span>
</Button>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Modals/EditCoverImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</template>
<template #default>
<div
class="absolute start-1/2 mt-3 w-96 max-w-lg -translate-x-1/2 transform rounded-6 bg-surface-base px-4 sm:px-0 lg:max-w-3xl"
class="absolute start-1/2 mt-3 w-96 max-w-lg -translate-x-1/2 rtl:translate-x-1/2 transform rounded-6 bg-surface-base px-4 sm:px-0 lg:max-w-3xl"
>
<div
class="overflow-hidden rounded-6 p-3 shadow-2xl ring-1 ring-outline-gray-2"
Expand Down
11 changes: 8 additions & 3 deletions frontend/src/components/Notes/InlineLessonMenu.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<div
class="text-sm absolute bg-surface-elevation-2 border rounded-5 z-10 w-44"
class="text-sm absolute bg-surface-elevation-2 border rounded-5 z-10 w-44 rtl:-translate-x-full"
:style="{
display: top > 0 ? 'block' : 'none',
top: top + 'px',
insetInlineStart: left + 'px',
left: left + 'px',
}"
>
<div class="space-y-2 py-2">
Expand Down Expand Up @@ -62,6 +62,7 @@ import { computed, inject, ref, watch } from 'vue'
import type { Note, Notes } from '@/types'
import type { FrappeResourceError } from 'frappe-ui'
import { blockQuotesClick, highlightText } from '@/utils'
import { isRtl } from '@/utils/textDirection'

const user = inject<any>('$user')
const show = defineModel()
Expand Down Expand Up @@ -108,7 +109,11 @@ const updateMenuPosition = () => {
const offsetX = window.scrollX

top.value = Math.floor(rect.top + offsetY - 40)
left.value = Math.floor(rect.right + offsetX + 10)
// Viewport coordinates are physical; in RTL the menu ends 10px left of the
// selection, its own width taken off by rtl:-translate-x-full.
left.value = isRtl()
? Math.floor(rect.left + offsetX - 10)
: Math.floor(rect.right + offsetX + 10)
}

const resetMenuPosition = () => {
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/components/Notifications/NotificationPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
isMobile
? {}
: {
left: sidebarLeft,
insetInlineStart: sidebarWidth,
width: '400px',
// A cast shadow is black alpha in either theme, the same way
// frappe-ui's own --elevation-* values are.
boxShadow: '8px 0px 8px rgba(0, 0, 0, 0.1)', // token-exempt: shadow
boxShadow: `${isRtl() ? -8 : 8}px 0px 8px rgba(0, 0, 0, 0.1)`, // token-exempt: shadow
}
"
>
Expand Down Expand Up @@ -109,6 +109,7 @@ import { decodeEntities } from '@/utils'
import { assignmentSubmissionFromLink } from '@/utils/notificationLinks'
import { useSidebar } from '@/stores/sidebar'
import { useScreenSize } from '@/utils/composables'
import { isRtl } from '@/utils/textDirection'
import EmptyStateLayout from '@/components/Layouts/EmptyStateLayout.vue'
import { serverTime } from '@/utils/dayjs'
import {
Expand Down Expand Up @@ -156,7 +157,7 @@ const emptyDescription = computed(() =>
: __('Notifications you have read will appear here.')
)

const sidebarLeft = computed(() =>
const sidebarWidth = computed(() =>
sidebarStore.isSidebarCollapsed ? '3rem' : '14rem'
)

Expand Down
10 changes: 7 additions & 3 deletions frontend/src/components/PdfBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
aria-label="Previous page"
@click="goToPage(currentPage - 1)"
>
<ChevronLeft :size="18" :stroke-width="1.5" />
<ChevronLeft :size="18" :stroke-width="1.5" class="rtl:rotate-180" />
</button>
<span class="pdf-page-indicator">{{
numPages ? currentPage + ' / ' + numPages : '-'
Expand All @@ -21,7 +21,7 @@
aria-label="Next page"
@click="goToPage(currentPage + 1)"
>
<ChevronRight :size="18" :stroke-width="1.5" />
<ChevronRight :size="18" :stroke-width="1.5" class="rtl:rotate-180" />
</button>
</div>
<div class="pdf-toolbar-group">
Expand Down Expand Up @@ -58,7 +58,11 @@
v-external
aria-label="Open in new tab"
>
<ExternalLink :size="16" :stroke-width="1.5" />
<ExternalLink
:size="16"
:stroke-width="1.5"
class="rtl:-scale-x-100"
Comment thread
raizasafeel marked this conversation as resolved.
Resolved
/>
</a>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/Profile/ProfileAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Tooltip
v-if="openTo"
:text="openTo === 'Work' ? __('Open to Work') : __('Hiring')"
side="right"
:side="inlineEndSide()"
>
<div class="absolute bottom-3 end-1 p-0.5 bg-surface-base rounded-full">
<div
Expand Down Expand Up @@ -43,6 +43,7 @@
</template>
<script setup lang="ts">
import { Tooltip } from 'frappe-ui'
import { inlineEndSide } from '@/utils/textDirection'
import { safeUrl } from '@/utils/safeUrl'

defineProps<{
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Profile/ProfileCover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/>
<div v-else class="bg-surface-gray-2 h-[130px] w-full"></div>
<div
class="absolute bottom-[30%] md:bottom-0 start-[50%] mb-4 flex -translate-x-1/2 gap-x-2 opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 [@media(hover:none)]:opacity-100"
class="absolute bottom-[30%] md:bottom-0 start-[50%] mb-4 flex -translate-x-1/2 rtl:translate-x-1/2 gap-x-2 opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 [@media(hover:none)]:opacity-100"
v-if="isSessionUser"
>
<EditCoverImage @select="(imageUrl: string) => emit('select', imageUrl)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<CodeEditor v-model="code" :extensions="extensions">
<CodeEditorContent
data-testid="exercise-code-editor"
dir="ltr"
:class="['h-full', contentClass]"
:style="{ '--code-radius': '0', '--code-bg': 'var(--surface-base)' }"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
<span class="flex items-center gap-x-1.5">
<span
class="size-3.5 shrink-0 text-ink-gray-5"
:class="open ? 'lucide-chevron-down' : 'lucide-chevron-right'"
:class="
open ? 'lucide-chevron-down' : 'lucide-chevron-right rtl:rotate-180'
"
/>
<span class="text-sm-semibold text-ink-gray-9">{{
__('Console')
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/ResponsiveListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
:to="bannerTarget"
:disabled="!bannerTarget"
>
<ListSelectBanner :class="bannerClass">
<ListSelectBanner :class="['lms-select-banner', bannerClass]">
<template #actions="bannerProps">
<slot name="selection-actions" v-bind="bannerProps" />
</template>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Settings/Settings.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<SettingsDialog v-model:open="show" v-model:tab="activeSlug" size="5xl">
<template #title>{{ __('Settings') }}</template>
<SettingsSidebar>
<SettingsSidebar class="lms-settings-nav">
<SettingsNavGroup v-for="group in tabs" :key="group.label">
<template #label>
<span class="text-xs-medium text-ink-gray-6">
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/components/Setup/SetupInvite.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,14 @@
v-if="canGoBack"
variant="ghost"
class="-me-2 ms-auto text-ink-gray-6"
icon-left="lucide-arrow-left"
:label="__('Back')"
:disabled="sending"
@click="emit('back')"
/>
>
<template #prefix>
<span class="lucide-arrow-left size-4 rtl:rotate-180" />
</template>
</Button>
</div>
</div>
</template>
Expand Down
Loading
Loading