-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab55f8d
commit 54d39e0
Showing
14 changed files
with
155 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
import Emoji from "emoji-store" | ||
let e = new Emoji({ | ||
let e_apple = new Emoji({ | ||
author: 'apple', | ||
size: 160, | ||
type: 'png' | ||
}) | ||
|
||
let e_facebook = new Emoji({ | ||
author: 'facebook', | ||
size: 96, | ||
type: 'png' | ||
}) | ||
|
||
|
||
type EmojiType = { | ||
emoji: string, | ||
type?: 'apple' | 'facebook' | ||
} | ||
|
||
export default function TextEmoji({ emoji, type }: EmojiType) { | ||
let em = e | ||
let em = e_apple | ||
if (type == 'facebook') | ||
em = new Emoji({ | ||
author: 'facebook', | ||
size: 96, | ||
type: 'png' | ||
}) | ||
return <img src={em.get(emoji)} alt="" className="inline-block h-[1.3em] align-middle" /> | ||
em = e_facebook | ||
return <img src={em.get(emoji)} alt={emoji} loading="lazy" className="inline-block h-[1.3em] align-middle" /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,7 @@ function More() { | |
{ | ||
name: 'Backup your data', | ||
icon: icons.backup, | ||
callback: () => navigate('/backup'), | ||
callback: () => { navigate('/backup') }, | ||
rightArrow: true | ||
}, | ||
{ | ||
|
@@ -110,10 +110,32 @@ function More() { | |
{ | ||
name: 'Join Telegram Channel', | ||
icon: icons.telegram_black, | ||
callback: () => window.open('https://t.me/routine_application', '_blank'), | ||
callback: () => { | ||
setModalUi(JoinTelegramUi) | ||
setIsShow(true) | ||
setModalButtons(['Cancel', 'Join']) | ||
setModalCallbacks([() => { setIsShow(false) }, | ||
() => window.open('https://t.me/routine_application', '_blank') | ||
]) | ||
}, | ||
rightArrow: true, | ||
newDot: true | ||
}, | ||
{ | ||
name: 'Send Feedback', | ||
icon: icons.chat, | ||
|
||
callback: () => { | ||
setModalUi(FeedBackUi) | ||
setIsShow(true) | ||
setModalButtons(['Cancel', 'Send Feedback']) | ||
setModalCallbacks([() => { setIsShow(false) }, | ||
() => | ||
window.open('mailto:[email protected]?subject=Feedback of Routine Application', '_blank') | ||
]) | ||
}, | ||
rightArrow: true | ||
}, | ||
{ | ||
name: 'Contributors', | ||
icon: icons.team, | ||
|
@@ -123,14 +145,6 @@ function More() { | |
rightArrow: true, | ||
// iconOriginal : true | ||
}, | ||
{ | ||
name: 'Send Feedback', | ||
icon: icons.chat, | ||
callback: () => { | ||
window.open('mailto:[email protected]?subject=Feedback of Routine Application', '_blank') | ||
}, | ||
rightArrow: true | ||
} | ||
] | ||
|
||
const navigate = useNavigate() | ||
|
@@ -223,8 +237,28 @@ export default More | |
|
||
function ResetEverythingUI() { | ||
return <> | ||
<p className='text-center text-xl font-semibold'>Are you sure you want to reset everything?</p> | ||
<div className='animate-bounce-slow mt-10 mb-10'><img src={Emoji.get('🤯')} alt="bag" className={`mx-auto mt-5 w-24 h-24`} /></div> | ||
<p className='text-center text-grey text-xs mt-5 font-[450]'>This will delete all your routines, subscriptions, and settings. <br />This action cannot be undone.</p> | ||
<p className='text-center text-xl font-semibold text-balance'>Are you sure you want to reset everything?</p> | ||
<div className='animate-bounce-slow mt-10 mb-10 '><img src={Emoji.get('🤯')} alt="bag" className={`mx-auto mt-5 w-24 h-24`} /></div> | ||
<p className='text-center text-grey text-xs mt-5 font-[450] text-balance'>It is advised to keep a backup before resetting everything. This will delete all your routines, subscriptions, and settings. This action cannot be undone. Are you sure?</p> | ||
</> | ||
} | ||
|
||
function JoinTelegramUi() { | ||
return <> | ||
<p className='text-center text-xl font-semibold text-balance'>Join Telegram channel to get latest updates <TextEmoji emoji='🤩' /> </p> | ||
<div className='animate-bounce-slow mt-10 mb-10 '><img src={icons.telegram} alt="bag" className={`mx-auto mt-5 w-28 h-28`} /></div> | ||
<p className='text-center text-grey text-xs mt-5 font-[450] text-balance'> | ||
Join Telegram Channel <a href="https://t.me/routine_application" target='_blank' className='text-accent'>routine_application</a> to get latest updates about this application. | ||
</p> | ||
</> | ||
} | ||
} | ||
function FeedBackUi() { | ||
return <> | ||
<p className='text-center text-xl font-semibold text-balance'>Send Feedback <TextEmoji emoji='🤩' /> </p> | ||
<div className='animate-bounce-slow mt-10 mb-10 '><img src={icons.chat} alt="bag" className={`mx-auto mt-5 w-24 h-24`} /></div> | ||
<p className='text-center text-grey text-xs mt-5 font-[450] text-balance'> | ||
Your feedback is valuable. Please send your feedback to <a href="mailto:[email protected]?subject=Feedback of Routine Application" target='_blank' className='text-accent'> | ||
[email protected]</a> | ||
</p> | ||
</> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,70 @@ | ||
import { useState } from 'react' | ||
import images from '../../assets/images/images' | ||
import BackHeader from '../../components/BackHeader' | ||
import icons from '../../assets/icons/icons' | ||
import ls from '../../lib/storage' | ||
import TextEmoji from '../../components/TextEmoji' | ||
|
||
function Backup() { | ||
const [isBackedUp, setBackedUp] = useState(false) | ||
const [backupBtnText, setBackupBtnText] = useState('Backup Now') | ||
|
||
|
||
return ( | ||
<div className='backup screen dark:text-darkText'> | ||
<BackHeader title='Backup your data' /> | ||
<section className='p-5 flex flex-col justify-center items-center pt-16'> | ||
<img src={images.undraw_add_notes_re_ln36} className='w-[70%] m-auto mt-10' /> | ||
<p className='mt-8 text-xs px-3 pt-2 text-center'>Back up your data by downloading the file. Keep it safe and use it when you next use this application or switch devices. </p> | ||
{!isBackedUp && <button onClick={() => backup()} className='no-highlight tap97 mt-5 bg-accent p-4 px-9 text-xs text-white font-medium rounded-full'>{backupBtnText}</button>} | ||
</section> | ||
{ | ||
isBackedUp && <BackUpSection /> | ||
} | ||
<div className='min-h-[80dvh] p-5 flex flex-col justify-center items-center gap-7'> | ||
<p className='text-center text-xl font-semibold text-balance'>Backup your data <TextEmoji emoji='📂' /> </p> | ||
|
||
<img src={icons.backup_folder} className='w-[45%] mx-auto drop-shadow-2xl' /> | ||
<p className='text-balance text-[0.65rem] text-center text-secondary'> | ||
You can backup your data by downloading a file. This file can be used to restore your data on another device. Or you can use it to restore your data if you reinstall the app. | ||
</p> | ||
<BackupUi /> | ||
</div> | ||
</div> | ||
) | ||
function backup() { | ||
setBackupBtnText('Backing up...') | ||
// Write Backup Code Here | ||
setTimeout(() => { | ||
setBackedUp(true) | ||
setBackupBtnText('Backup Again') | ||
}, 1000); | ||
} | ||
export function BackupUi() { | ||
const [isBackingUp, setIsBackingUp] = useState(false) | ||
const [isBackedUp, setIsBackedUp] = useState(false) | ||
|
||
function backupBtnClick() { | ||
setIsBackingUp(true) | ||
setTimeout(() => { | ||
setBackedUp(false) | ||
}, 5000); | ||
createBackup() | ||
setIsBackingUp(false) | ||
setIsBackedUp(true) | ||
}, 500); | ||
} | ||
} | ||
|
||
function BackUpSection() { | ||
return ( | ||
<div className="p-5"> | ||
<p className='text-xs text-center'>Your data has been backed up successfully.</p> | ||
<div className='flex flex-col gap-2 mt-5'> | ||
<button className='btn-full text-sm no-highlight tap99'>Download 2281416.json</button> | ||
</div> | ||
return <> | ||
{/* <div className='animate-bounce-slow mt-10 mb-10 '><img src={icons.backup} alt="bag" className={`mx-auto mt-5 w-24 h-24`} /></div> */} | ||
<div className='flex justify-center items-center pt-10'> | ||
<button className="no-highlight tap99 bg-dark text-white p-4 px-14 font-medium rounded-[0.65rem] text-xs" | ||
disabled={isBackingUp} | ||
onClick={backupBtnClick} | ||
> | ||
{ | ||
isBackingUp ? 'Preparing Backup...' : isBackedUp ? 'Backup Again' : 'Download Backup' | ||
} | ||
</button> | ||
</div> | ||
) | ||
<p className='text-center text-grey text-[0.65rem] mt-5 text-balance'>This will download a backup file containing all your data. </p> | ||
</> | ||
} | ||
|
||
function createBackup() { | ||
const routines = JSON.parse(ls.get('routines') || '[]') | ||
const subscriptions = JSON.parse(ls.get('subscriptions') || '[]') | ||
|
||
const backup = { routines, subscriptions } | ||
|
||
const dataStr = JSON.stringify(backup) | ||
const blob = new Blob([dataStr], { type: "text/plain;charset=utf-8" }); | ||
const url = window.URL.createObjectURL(blob); | ||
const a = document.createElement('a'); | ||
a.href = url; | ||
a.download = 'routine_backup.json'; | ||
a.click(); | ||
a.remove() | ||
window.URL.revokeObjectURL(url); | ||
} | ||
|
||
export default Backup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.