Skip to content

Commit e0e45d7

Browse files
authored
Merge pull request #372 from widgetify-app/simplify-extension-modal
Simplify extension modal
2 parents b8611f3 + 21fd936 commit e0e45d7

File tree

9 files changed

+69
-203
lines changed

9 files changed

+69
-203
lines changed

src/components/extension-installed-modal.tsx

Lines changed: 18 additions & 192 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { domAnimation, LazyMotion, m } from 'framer-motion'
21
import { useState } from 'react'
32
import { FaExternalLinkAlt } from 'react-icons/fa'
43
import keepItImage from '@/assets/keep-it.png'
@@ -11,32 +10,10 @@ interface ExtensionInstalledModalProps {
1110
onClose: () => void
1211
onGetStarted: () => void
1312
}
14-
15-
type Step = number
16-
1713
export function ExtensionInstalledModal({
1814
show,
1915
onGetStarted,
2016
}: ExtensionInstalledModalProps) {
21-
const [currentStep, setCurrentStep] = useState<Step>(1)
22-
const totalSteps = 3
23-
24-
const renderStepContent = () => {
25-
switch (currentStep) {
26-
case 1:
27-
if (import.meta.env.FIREFOX) {
28-
return <StepFirefoxConsent setCurrentStep={setCurrentStep} />
29-
}
30-
return <StepOne setCurrentStep={setCurrentStep} />
31-
case 2:
32-
return <StepFooterDisable setCurrentStep={setCurrentStep} />
33-
case 3:
34-
return <StepThree onGetStarted={onGetStarted} />
35-
default:
36-
return null
37-
}
38-
}
39-
4017
return (
4118
<Modal
4219
isOpen={show}
@@ -46,59 +23,23 @@ export function ExtensionInstalledModal({
4623
showCloseButton={false}
4724
closeOnBackdropClick={false}
4825
>
49-
<LazyMotion features={domAnimation}>
50-
<m.div
51-
className={'flex flex-col items-center p-2 text-center w-full'}
52-
initial={{ opacity: 0 }}
53-
animate={{ opacity: 1 }}
54-
transition={{ duration: 0.4 }}
55-
>
56-
{renderStepContent()}
57-
</m.div>
58-
</LazyMotion>
59-
60-
<StepIndicator totalSteps={totalSteps} currentStep={currentStep} />
26+
{import.meta.env.FIREFOX ? (
27+
<StepFirefoxConsent onGetStarted={onGetStarted} />
28+
) : (
29+
<StepOne onGetStarted={onGetStarted} />
30+
)}
6131
</Modal>
6232
)
6333
}
64-
interface StepIndicatorProps {
65-
totalSteps: number
66-
currentStep: Step
67-
}
68-
const StepIndicator = ({ totalSteps, currentStep }: StepIndicatorProps) => (
69-
<div
70-
className="flex items-center justify-center gap-3"
71-
role="progressbar"
72-
aria-valuenow={currentStep}
73-
aria-valuemin={1}
74-
aria-valuemax={totalSteps}
75-
>
76-
{Array.from({ length: totalSteps }).map((_, index) => (
77-
<button
78-
key={index}
79-
aria-label={`رفتن به گام ${index + 1}`}
80-
aria-current={index + 1 === currentStep ? 'step' : undefined}
81-
className={`w-10 h-2 cursor-default rounded-full transition-all duration-300 ${
82-
index + 1 === currentStep
83-
? 'bg-blue-500 shadow-lg shadow-blue-500/30'
84-
: index + 1 < currentStep
85-
? 'bg-blue-600'
86-
: 'bg-gray-700 hover:bg-gray-600'
87-
}`}
88-
/>
89-
))}
90-
</div>
91-
)
92-
9334
interface StepOneProps {
94-
setCurrentStep: (step: Step) => void
35+
onGetStarted: () => void
9536
}
96-
const StepOne = ({ setCurrentStep }: StepOneProps) => {
37+
const StepOne = ({ onGetStarted }: StepOneProps) => {
9738
return (
9839
<>
9940
<div className="mb-3">
10041
<h3 className={'mb-0 text-2xl font-bold text-content'}>
101-
به ویجتی‌فای خوش آمدید! 🎉
42+
به ویجتیفای خوش آمدید! 🎉
10243
</h3>
10344
</div>
10445

@@ -119,7 +60,7 @@ const StepOne = ({ setCurrentStep }: StepOneProps) => {
11960

12061
<div
12162
className={
122-
'p-3 mb-3 text-content rounded-lg border border-content bg-content'
63+
'p-3 mb-2 text-content rounded-lg border border-content bg-content'
12364
}
12465
>
12566
<p className="font-bold text-muted">
@@ -129,135 +70,20 @@ const StepOne = ({ setCurrentStep }: StepOneProps) => {
12970

13071
<Button
13172
size="md"
132-
onClick={() => setCurrentStep(2)}
133-
className="!px-4 !py-2 mx-auto font-light shadow w-52 rounded-2xl shadow-primary"
73+
onClick={onGetStarted}
74+
className="w-full text-base font-light shadow-sm rounded-2xl shadow-primary outline-none!"
13475
isPrimary={true}
13576
>
136-
Keep It رو زدم!
77+
شروع کنید
13778
</Button>
13879
</>
13980
)
14081
}
14182

142-
interface StepFooterDisableProps {
143-
setCurrentStep: (step: Step) => void
144-
}
145-
const StepFooterDisable = ({ setCurrentStep }: StepFooterDisableProps) => {
146-
const [counter, setCounter] = useState<number>(5)
147-
148-
useEffect(() => {
149-
const interval = setInterval(() => {
150-
setCounter((prev) => {
151-
if (prev <= 1) {
152-
clearInterval(interval)
153-
return 0
154-
}
155-
return prev - 1
156-
})
157-
}, 1000)
158-
return () => clearInterval(interval)
159-
}, [])
160-
161-
return (
162-
<>
163-
<div className="mb-3">
164-
<h3 className={'mb-0 text-2xl font-bold text-content'}>
165-
مخفی کردن نوار پایین مرورگر
166-
</h3>
167-
</div>
168-
169-
<div
170-
className={
171-
'relative p-1 mt-1 mb-3 border rounded-xl border-content bg-content'
172-
}
173-
>
174-
<div className="flex items-center justify-center">
175-
<img
176-
src="https://cdn.widgetify.ir/extension/how-to-disable-footer.png"
177-
alt="نحوه مخفی کردن نوار پایین مرورگر"
178-
className="h-auto max-w-full rounded-lg shadow-xl"
179-
style={{ maxHeight: '220px' }}
180-
/>
181-
</div>
182-
</div>
183-
184-
<div
185-
className={
186-
'p-3 mb-3 text-content rounded-lg border border-content bg-content'
187-
}
188-
>
189-
<p className="font-bold text-muted">
190-
💡 برای زیبایی بیشتر، میتونید نوار خاکستری پایین مرورگر رو مانند این
191-
تصویر مخفی کنید
192-
</p>
193-
</div>
194-
195-
{counter === 0 ? (
196-
<Button
197-
size="sm"
198-
onClick={() => setCurrentStep(3)}
199-
className="!px-4 !py-2 mx-auto font-light shadow w-52 rounded-2xl shadow-primary"
200-
isPrimary={true}
201-
>
202-
گام بعدی
203-
</Button>
204-
) : (
205-
<div className="px-4 py-2 mx-auto text-sm text-center border w-52 text-muted rounded-2xl border-content">
206-
لطفاً صبر کنید... {counter} ثانیه
207-
</div>
208-
)}
209-
</>
210-
)
211-
}
212-
213-
interface StepThreeProps {
214-
onGetStarted: () => void
215-
}
216-
const StepThree = ({ onGetStarted }: StepThreeProps) => {
217-
return (
218-
<>
219-
<m.div
220-
className="mb-6"
221-
initial={{ y: -20 }}
222-
animate={{ y: 0 }}
223-
transition={{ duration: 0.5, delay: 0.2 }}
224-
>
225-
<h3 className={'mb-3 text-2xl font-bold text-content'}>
226-
آماده شروع هستید؟
227-
</h3>
228-
</m.div>
229-
230-
<m.div
231-
className={
232-
'p-3 mb-6 border rounded-lg bg-content backdrop-blur-sm border-content'
233-
}
234-
initial={{ opacity: 0, y: 10 }}
235-
animate={{ opacity: 1, y: 0 }}
236-
transition={{ duration: 0.5, delay: 0.3 }}
237-
>
238-
<p className="text-muted">
239-
بریم که یک تجربه جدید و جذاب را شروع کنیم! 😎
240-
</p>
241-
</m.div>
242-
243-
<div className="flex flex-col w-full gap-4 mt-4 sm:flex-row">
244-
<Button
245-
onClick={onGetStarted}
246-
className="w-full font-light sm:flex-1 rounded-2xl"
247-
size="md"
248-
isPrimary={true}
249-
>
250-
شروع کنید
251-
</Button>
252-
</div>
253-
</>
254-
)
255-
}
256-
25783
interface StepFirefoxConsentProps {
258-
setCurrentStep: (step: Step) => void
84+
onGetStarted: () => void
25985
}
260-
const StepFirefoxConsent = ({ setCurrentStep }: StepFirefoxConsentProps) => {
86+
const StepFirefoxConsent = ({ onGetStarted }: StepFirefoxConsentProps) => {
26187
const [isAccepted, setIsAccepted] = useState(false)
26288
const handleDecline = () => {
26389
if (browser.management?.uninstallSelf) {
@@ -273,7 +99,7 @@ const StepFirefoxConsent = ({ setCurrentStep }: StepFirefoxConsentProps) => {
27399
return (
274100
<div className="w-full overflow-clip">
275101
<h3 className="mb-3 text-2xl font-bold text-content">Privacy Notice</h3>
276-
<p className="mb-2 font-semibold">خلاصه سیاست حریم خصوصی ویجتی‌فای:</p>
102+
<p className="mb-2 font-semibold">خلاصه سیاست حریم خصوصی ویجتیفای:</p>
277103
<div className="w-full px-2">
278104
<ul className="w-full h-56 space-y-1 overflow-y-auto text-xs list-disc list-inside border border-content rounded-2xl">
279105
<li>هیچ داده شخصی به‌طور پیش‌فرض جمع‌آوری نمی‌شود.</li>
@@ -296,7 +122,7 @@ const StepFirefoxConsent = ({ setCurrentStep }: StepFirefoxConsentProps) => {
296122
می‌شود. این مورد کاملاً اختیاری است و می‌توانید آن را رد کنید.
297123
</li>
298124
<li>هیچ داده‌ای با اشخاص ثالث به اشتراک گذاشته نمی‌شود.</li>
299-
<li>ویجتی‌فای متن‌باز است و کد آن روی GitHub قابل بررسی است.</li>
125+
<li>ویجتیفای متن‌باز است و کد آن روی GitHub قابل بررسی است.</li>
300126
<li>
301127
درخواست حذف کامل داده‌ها در هر زمان از طریق{' '}
302128
<a
@@ -332,7 +158,7 @@ const StepFirefoxConsent = ({ setCurrentStep }: StepFirefoxConsentProps) => {
332158
onChange={() => setIsAccepted(!isAccepted)}
333159
/>
334160
<span className="mr-2 text-sm">
335-
با سیاست حریم خصوصی ویجتی‌فای موافقم.
161+
با سیاست حریم خصوصی ویجتیفای موافقم.
336162
</span>
337163
</div>
338164
</div>
@@ -346,7 +172,7 @@ const StepFirefoxConsent = ({ setCurrentStep }: StepFirefoxConsentProps) => {
346172
🚫 حذف افزونه
347173
</Button>
348174
<Button
349-
onClick={() => setCurrentStep(2)}
175+
onClick={onGetStarted}
350176
size="md"
351177
className="w-40 btn btn-success rounded-xl"
352178
disabled={!isAccepted}

src/layouts/bookmark/components/bookmark-suggestions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function BookmarkSuggestions({ onSelect }: BookmarkSuggestionsProps) {
1919

2020
return (
2121
<div className="mt-2">
22-
<SectionPanel title="پیشنهاد ویجتی‌فای" size="xs">
22+
<SectionPanel title="پیشنهاد ویجتیفای" size="xs">
2323
<div className="grid h-16 grid-cols-5 gap-2 mt-1 overflow-y-auto">
2424
{suggestions.map((suggestion, index) => (
2525
<div

src/layouts/navbar/navbar.layout.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ export function NavbarLayout(): JSX.Element {
9393
: '-bottom-32 opacity-0 scale-95 pointer-events-none'
9494
}`}
9595
>
96+
<div
97+
className="absolute w-full h-10 bg-transparent -bottom-16"
98+
id="chrome-footer"
99+
></div>
96100
<nav className="relative flex items-center gap-1 p-1.5 bg-white/[0.02] backdrop-blur-sm border border-white/[0.08] rounded-[2.5rem]">
97101
<button
98102
onClick={() => onToggleNavbar()}

src/layouts/setting/tabs/about-us/about-us.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function AboutUsTab() {
7878
</div>
7979
<h3 className={'text-sm font-medium text-content'}>حمایت مالی</h3>
8080
<p className={'mt-1 text-xs text-center text-content'}>
81-
کمک به توسعه ویجتی‌فای
81+
کمک به توسعه ویجتیفای
8282
</p>
8383
</a>
8484

@@ -147,7 +147,7 @@ export function AboutUsTab() {
147147
</div>
148148

149149
<div className={'mt-2 mb-4 text-xs text-center text-content opacity-55'}>
150-
© ویجتی‌فای - تمامی حقوق محفوظ است
150+
© ویجتیفای - تمامی حقوق محفوظ است
151151
</div>
152152
</div>
153153
)

src/layouts/setting/tabs/appearance/components/theme-selector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export function ThemeSelector({ fetched_themes }: Props) {
107107
return (
108108
<SectionPanel title="انتخاب تم" delay={0.2} size="sm">
109109
<div className="space-y-3">
110-
<p className="text-sm text-muted">تم ظاهری ویجتی‌فای را انتخاب کنید.</p>
110+
<p className="text-sm text-muted">تم ظاهری ویجتیفای را انتخاب کنید.</p>
111111

112112
<div className="grid grid-cols-1 gap-2 md:grid-cols-2 lg:grid-cols-3">
113113
{themes.map((item) => (

src/layouts/setting/tabs/shortcuts/shortcuts.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export function ShortcutsTab() {
7373
<SectionPanel title="کلیدهای میانبر" delay={0.1}>
7474
<div className="space-y-5">
7575
<p className="text-muted">
76-
کلیدهای میانبر افزونه ویجتی‌فای برای استفاده راحت‌تر و سریع‌تر
76+
کلیدهای میانبر افزونه ویجتیفای برای استفاده راحت‌تر و سریع‌تر
7777
</p>
7878

7979
{Object.entries(categories).map(([category, categoryShortcuts]) => (

src/layouts/widgets/todos/expandable-todo-input.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { PriorityButton } from '@/components/priority-options/priority-options'
1414
import Analytics from '@/analytics'
1515
import { Chip } from '@/components/chip.component'
1616
import { useGetTags } from '@/services/hooks/todo/get-tags.hook'
17+
import { useAuth } from '@/context/auth.context'
1718

1819
interface ExpandableTodoInputProps {
1920
todoText: string
@@ -26,10 +27,11 @@ export function ExpandableTodoInput({
2627
onChangeTodoText,
2728
onAddTodo,
2829
}: ExpandableTodoInputProps) {
30+
const { isAuthenticated } = useAuth()
2931
const [isExpanded, setIsExpanded] = useState(false)
3032
const [priority, setPriority] = useState<TodoPriority>(TodoPriority.Medium)
3133
const [category, setCategory] = useState('')
32-
const { data: fetchedTags } = useGetTags(true)
34+
const { data: fetchedTags } = useGetTags(isAuthenticated)
3335
const [notes, setNotes] = useState('')
3436
const [isTagTooltipOpen, setIsTagTooltipOpen] = useState(false)
3537
const [selectedDate, setSelectedDate] = useState<jalaliMoment.Moment | undefined>()

src/layouts/widgets/tools/translate/components/platform-modal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function PlatformModal({ isOpen, onClose, platform }: PlatformModalProps)
4545

4646
<div className="space-y-2 text-sm leading-relaxed text-content/80">
4747
<p>
48-
ویجتی‌فای هیچگونه نقشی در ترجمه ندارد. ترجمه توسط{' '}
48+
ویجتیفای هیچگونه نقشی در ترجمه ندارد. ترجمه توسط{' '}
4949
<button
5050
onClick={handleOpenLink}
5151
className="font-medium text-blue-400 underline cursor-pointer hover:text-blue-500"
@@ -56,7 +56,7 @@ export function PlatformModal({ isOpen, onClose, platform }: PlatformModalProps)
5656
</p>
5757
<p className="text-xs text-content/60">
5858
داده‌های شما (فقط متن ورودی) مستقیماً به سرویس ترجمه ارسال می‌شود و
59-
ویجتی‌فای دسترسی به آن ندارد.
59+
ویجتیفای دسترسی به آن ندارد.
6060
</p>
6161
</div>
6262

0 commit comments

Comments
 (0)