Skip to content

Commit

Permalink
Skeleton Loading, updated UI
Browse files Browse the repository at this point in the history
  • Loading branch information
codeAbinash committed Jun 25, 2023
1 parent 3840f43 commit 5018fd1
Show file tree
Hide file tree
Showing 22 changed files with 208 additions and 77 deletions.
27 changes: 24 additions & 3 deletions public/changelog/changelog.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
[
{
"version": "3.6.2",
"name": "UI Improvements",
"emoji": [
"🎨", "😯"
],
"date": "2023-06-25",
"description": [
"Added skeleton loading animation to the app.",
"Improved performance of the app.",
"Updated UI of the app."
]
},
{
"version": "3.6.1",
"name": "Manifest Update",
"emoji": ["πŸ“", "βš™οΈ", "🎨"],
"emoji": [
"πŸ“",
"βš™οΈ",
"🎨"
],
"date": "2023-06-25",
"description": [
"Updated the manifest file of the app.",
Expand Down Expand Up @@ -317,7 +334,10 @@
{
"version": "1.6.0",
"name": "New UI",
"emoji": ["🎨", "🀩"],
"emoji": [
"🎨",
"🀩"
],
"date": "2023-03-08",
"description": [
"Added a new UI to the app.",
Expand All @@ -337,7 +357,8 @@
"name": "Dark Theme",
"emoji": [
"😎",
"🎨", "πŸŒ‘"
"🎨",
"πŸŒ‘"
],
"date": "2023-02-21",
"description": [
Expand Down
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Calendar from './pages/Calendar'
import Home from './pages/Home'
import Routines from './pages/Routines'
// import More from './pages/More'
import Loading from './components/Loading'
import Loading from './components/loading/Loading'
import { loadTheme } from './lib/theme'
// import ViewRoutine from './pages/ViewRoutine'

Expand Down
3 changes: 2 additions & 1 deletion src/assets/icons/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import edit from './src/edit.svg'
import telegram from './src/telegram.svg'
import backup_folder from './src/backup_folder.webp'
import restore_file from './src/restore_file.webp'
import app_icon_transparent_256 from './src/app_icon_transparent_256.png'


const icons = {
Expand All @@ -45,7 +46,7 @@ const icons = {
right_arrow_next, shield, theme, left_arrow,
backup, restore, shield_cross, telegram_black,
spinner, chat, del, edit, telegram, backup_folder,
restore_file
restore_file, app_icon_transparent_256
}


Expand Down
Binary file added src/assets/icons/src/app_icon_transparent_256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 25 additions & 1 deletion src/assets/scss/common/_classes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -443,4 +443,28 @@ button.btn-full-width.grey {
.scrollbar-hidden {
-ms-overflow-style: none;
scrollbar-width: none;
}
}



.place-1-1 {
grid-column: 1 / span 1;
grid-row: 1 / span 1;
}


// @keyframes pulse {
// 0% {
// opacity: 1;
// }
// 50% {
// opacity: 0.4;
// }
// 100% {
// opacity: 1;
// }
// }

// .animate-pulse {
// animation: pulse 1.5s ease-in-out infinite;
// }
5 changes: 4 additions & 1 deletion src/components/BottomModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ export default function BottomModal({ show, children, btnTxt, cb }: { show: bool
export function BasicModal({ text, desc, emoji }: { text: any, desc?: any, emoji?: any }) {
return <>
<p className='text-center text-xl font-semibold px-[7%] text-balance'>{text}</p>
<div className='animate-bounce-slow mt-10 mb-10'><img src={Emoji.get(emoji || 'πŸ€”')} alt="emoji" className={`mx-auto mt-5 w-24 h-24`} /></div>
<div className='grid animate-bounce-slow mt-10 mb-10'>
<img src={Emoji.get(emoji || 'πŸ€”')} alt="emoji" className={`place-1-1 blur-lg opacity-50 mx-auto mt-5 w-24 h-24`} />
<img src={Emoji.get(emoji || 'πŸ€”')} alt="emoji" className={`place-1-1 mx-auto mt-5 w-24 h-24 z-10`} />
</div>
<p className='text-center text-grey text-xs mt-5 font-[450] px-[5%] text-balance'>
{desc}
</p>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Watermark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function Watermark({ visible }: any) {

// console.log(isWatermark)
return (
<div className={`opacity-100 pb-10 pt-10 flex justify-center items-center -z-10 text-center`}>
<div className={`pb-10 pt-10 flex justify-center items-center -z-10 text-center`}>
<p className={
`font-medium tap97 text-[0.7em] text-dark/50 dark:text-darkText/50`
}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import icons from "../assets/icons/icons"
import icons from "../../assets/icons/icons"

function Loading() {
return (
Expand Down
35 changes: 35 additions & 0 deletions src/components/loading/LoadingRoutines.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function LoadingRoutine() {
return <div className='flex justify-center items-center'>
<div className="lg:w-[32.5%] md:w-[49.5%] w-full flex-wrap routine flex flex-col p-[1.2rem] rounded-[1.6rem] tap99 bg-routine_bg dark:bg-darkInputBg border-[1px] border-routine_border dark:border-routine_border_dark" key="{randomString(5)}">
<div className="top flex flex-row gap-3">
<div className="left">
<div className="emoji bg-main aspect-square rounded-xl p-2 flex-1 dark:bg-black/40">
<div className="animate-pulse bg-gray-300 dark:bg-[#ffffff20] rounded-full h-6 w-6"></div>
</div>
</div>
<div className="right flex-1 flex flex-col justify-between">
<div className='w-[100%] h-[1.2rem] bg-gray-200 dark:bg-[#ffffff10] animate-pulse rounded'>
</div>
<div className="routine-description w-full mt-2">
<div className="w-[90%] animate-pulse bg-gray-200 dark:bg-[#ffffff10] rounded h-3.5 mt-2"></div>
</div>
<div className="routine-description w-full">
<div className="w-[50%] animate-pulse bg-gray-200 dark:bg-[#ffffff10] rounded h-3.5 mt-2"></div>
</div>
</div>
</div>
</div>
</div>
}


export default function LoadingRoutines() {
return <div className='w-full flex flex-col gap-3'>
<LoadingRoutine />
<LoadingRoutine />
<LoadingRoutine />
<LoadingRoutine />
<LoadingRoutine />
<LoadingRoutine />
</div>
}
2 changes: 1 addition & 1 deletion src/info.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const details = {
name: 'routine',
version: '3.6.1'
version: '3.6.2'
}
export default details
29 changes: 22 additions & 7 deletions src/pages/ApplyRoutine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import TextEmoji from "../components/TextEmoji";
import ls from '../lib/storage'
import { useEffect, useMemo, useState } from "react";
import Header from "../components/Header";
import Loading from "../components/Loading";
import Loading from "../components/loading/Loading";
import BottomModal from "../components/BottomModal";
import Emoji from "emoji-store";

Expand All @@ -24,15 +24,21 @@ function deleteRoutineById(routineID: string) {
function EnterValidRoutineIdUI() {
return <>
<p className='text-center text-xl font-semibold'>Enter a valid routine ID <TextEmoji emoji="🀨" /></p>
<div className='animate-bounce-slow mt-10 mb-10'><img src={Emoji.get('πŸ€”')} alt="emoji" className={`mx-auto mt-5 w-24 h-24`} /></div>
<div className='animate-bounce-slow mt-10 mb-10 grid'>
<img src={Emoji.get('πŸ€”')} alt="emoji" className={`mx-auto mt-5 w-24 h-24 place-1-1 opacity-50 blur-lg`} />
<img src={Emoji.get('πŸ€”')} alt="emoji" className={`mx-auto mt-5 w-24 h-24 z-10 place-1-1`} />
</div>
<p className='text-center text-grey text-xs mt-5 font-[450]'>If you cannot find your routine ID, please contact <a className="text-accent" href="mailto:[email protected]">me</a>.</p>
</>
}

function RoutineAppliedUI({ routineId }: { routineId: string }) {
return <>
<p className='text-center text-xl font-semibold'>Routine Applied <TextEmoji emoji="βœ…" /></p>
<div className='animate-bounce-slow mt-10 mb-10'><img src={Emoji.get('🀩')} alt="emoji" className={`mx-auto mt-5 w-24 h-24`} /></div>
<div className='animate-bounce-slow mt-10 mb-10 grid'>
<img src={Emoji.get('🀩')} alt="emoji" className={`mx-auto mt-5 w-24 h-24 place-1-1 opacity-50 blur-lg`} />
<img src={Emoji.get('🀩')} alt="emoji" className={`mx-auto mt-5 w-24 h-24 z-10 place-1-1`} />
</div>
<p className='text-center text-grey text-xs mt-5 font-[450]'>
Routine id : <span className="text-accent">{routineId}</span>. Go back now?
</p>
Expand All @@ -42,7 +48,10 @@ function RoutineAppliedUI({ routineId }: { routineId: string }) {
function AlreadySubscribedUI({ routineId }: { routineId: string }) {
return <>
<p className='text-center text-xl font-semibold'>Already Subscribed <TextEmoji emoji="😁" /></p>
<div className='animate-bounce-slow mt-10 mb-10'><img src={Emoji.get('πŸ˜‰')} alt="emoji" className={`mx-auto mt-5 w-24 h-24`} /></div>
<div className='animate-bounce-slow mt-10 mb-10 grid'>
<img src={Emoji.get('πŸ˜‰')} alt="emoji" className={`mx-auto mt-5 w-24 h-24 place-1-1 opacity-50 blur-lg`} />
<img src={Emoji.get('πŸ˜‰')} alt="emoji" className={`mx-auto mt-5 w-24 h-24 z-10 place-1-1`} />
</div>
<p className='text-center text-grey text-xs mt-5 font-[450]'>
You are already subscribed to this routine! <br />
Routine id : <span className="text-accent">{routineId}</span>
Expand All @@ -53,7 +62,10 @@ function AlreadySubscribedUI({ routineId }: { routineId: string }) {
function SkipUI() {
return <>
<p className='text-center text-xl font-semibold'>Skip for now ?</p>
<div className='animate-bounce-slow mt-10 mb-10'><img src={Emoji.get('πŸ‘‰πŸ»')} alt="emoji" className={`mx-auto mt-5 w-24 h-24`} /></div>
<div className='animate-bounce-slow mt-10 mb-10 grid'>
<img src={Emoji.get('πŸ‘‰πŸ»')} alt="emoji" className={`mx-auto mt-5 w-24 h-24 place-1-1 opacity-50 blur-lg`} />
<img src={Emoji.get('πŸ‘‰πŸ»')} alt="emoji" className={`mx-auto mt-5 w-24 h-24 z-10 place-1-1`} />
</div>
<p className='text-center text-grey text-xs mt-5 font-[450] px-[7%]'>
You can skip this step for now. You can add routines later from settings.
</p>
Expand All @@ -63,7 +75,10 @@ function SkipUI() {
function RoutineNotFoundUI({ routineId }: { routineId: string }) {
return <>
<p className='text-center text-xl font-semibold'>Routine Not Found <TextEmoji emoji="😒" /></p>
<div className='animate-bounce-slow mt-10 mb-10'><img src={Emoji.get('😒')} alt="emoji" className={`mx-auto mt-5 w-24 h-24`} /></div>
<div className='animate-bounce-slow mt-10 mb-10 grid'>
<img src={Emoji.get('😒')} alt="emoji" className={`mx-auto mt-5 w-24 h-24 place-1-1 opacity-50 blur-lg`} />
<img src={Emoji.get('😒')} alt="emoji" className={`mx-auto mt-5 w-24 h-24 z-10 place-1-1`} />
</div>
<p className='text-center text-grey text-xs mt-5 font-[450] px-[7%]'>
Cannot find routine <span className="text-accent">{routineId}</span> Maybe the routine you are looking
for is not available. Please check the routine id again. <br /><br />
Expand Down Expand Up @@ -107,7 +122,7 @@ export default function ApplyRoutine() {
return (
<div className="screen dark:text-white">
<BottomModal show={modalShow} btnTxt={modalBtnText} cb={modalCallback}>{modalUi}</BottomModal>
<Header title={startedUsing ? <>Routine Store <TextEmoji emoji="πŸ‘œ" /></> : <>Select Routine <TextEmoji emoji="🧐"/></>}
<Header title={startedUsing ? <>Routine Store <TextEmoji emoji="πŸ‘œ" /></> : <>Select Routine <TextEmoji emoji="🧐" /></>}
notiIcon={false} placeholder="Search Routine" onInput={() => { }}
/>
<div className="px-5 py-1 flex flex-col gap-4">
Expand Down
39 changes: 31 additions & 8 deletions src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import TextEmoji from '../components/TextEmoji'
import Emoji from 'emoji-store'
import delay, { df } from '../lib/delay'
import BottomModal from '../components/BottomModal'
import LoadingRoutines from '../components/loading/LoadingRoutines'


// Delete the subscription if the subscription is expired
Expand Down Expand Up @@ -56,13 +57,13 @@ function deleteRoutineBySub(subscriptionKey: string) {
}

function Home() {
// const [name, updateName] = useState(1)
const [screenRoutines, uTodayRoutine] = useState<any>([])
const navigate = useNavigate()
// const timer1 = useRef<any>(null);
const timer2 = useRef<any>(null);
const [isRoutineEmpty, setIsRoutineEmpty] = useState(false)
let routines = useMemo(() => JSON.parse(ls.get('routines') || '[]'), [])
const [showLoading, setShowLoading] = useState(true)


useEffect(() => {
// Check if started using
Expand Down Expand Up @@ -101,15 +102,34 @@ function Home() {
}
}, [])


useEffect(() => {
// Disable loading after 1.5s
const timer = setTimeout(() => {
setShowLoading(false)
}, 300)

return () => {
clearTimeout(timer)
}

}, [screenRoutines])


return (
<div className="home-screen screen-navbar select-none dark:bg-black dark:text-darkText">
<Header title={<span>{getCurrentDate()} <TextEmoji emoji={getEmojiOfDayByTime()} /></span>} notiIcon={true} placeholder="Search Routine" />

<section className='p-[1.2rem] pt-3'>
{/* <p className='text-[#777]/50 text-center mt-2 mb-5 text-sm font-medium'>Today's routines</p> */}
<div className="routines flex flex-col gap-[0.9rem]">
<GetRoutines screenRoutines={screenRoutines} allRoutines={routines} />
</div>
<NewRoutinesLoader />
{
showLoading ? <LoadingRoutines /> :
<>
<div className="routines flex flex-col gap-[0.9rem]">
<GetRoutines screenRoutines={screenRoutines} allRoutines={routines} />
</div>
<NewRoutinesLoader />
</>
}
</section>
<FloatingButton />
<Watermark />
Expand All @@ -124,7 +144,10 @@ function Home() {
function NoRoutineUi() {
return <>
<p className='text-center text-xl font-semibold'>You have no Routine <TextEmoji emoji='πŸ˜•' /> !</p>
<div className='animate-bounce-slow mt-10 mb-10'><img src={Emoji.get('πŸ‘œ')} alt="bag" className={`mx-auto mt-5 w-28 h-28`} /></div>
<div className='grid animate-bounce-slow mt-10 mb-10'>
<img src={Emoji.get('πŸ‘œ')} alt="bag" className={`place-1-1 mx-auto mt-5 w-28 h-28 blur-xl opacity-50`} />
<img src={Emoji.get('πŸ‘œ')} alt="bag" className={`place-1-1 mx-auto mt-5 w-28 h-28 z-10`} />
</div>
<p className='text-center text-grey text-xs mt-5 font-[450]'>Go to Routine <TextEmoji emoji='πŸ“ƒ' /> Store <TextEmoji emoji='πŸ‘œ' /> <br />to add new Routines !</p>
</>
}
Expand Down
10 changes: 7 additions & 3 deletions src/pages/ManageRoutine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import TextEmoji from "../components/TextEmoji";
import ls from '../lib/storage'
import { useEffect, useMemo, useState } from "react";
import Header from "../components/Header";
import Loading from "../components/Loading";
import Loading from "../components/loading/Loading";
import { MODAL_BUTTON_TEXT } from "../lib/lib";
import BottomModal, { BasicModal } from "../components/BottomModal";
import icons from "../assets/icons/icons";

function deleteRoutineById(routineID: string) {
let routines = JSON.parse(ls.get('routines') || '[]')
Expand Down Expand Up @@ -87,8 +88,11 @@ function Routines({ deleteRoutine }: any) {
<div className="flex flex-col gap-3">
{
routines.length === 0
? <div className="min-h-[50dvh] justify-center items-center flex">
<p className="font-medium text-sm text-grey">No Routine</p>
? <div className="min-h-[60dvh] justify-center items-center gap-5 flex flex-col">
<img src={icons.app_icon_transparent_256} className="w-[55%]" />
<p className="text-sm text-secondary text-center">
You haven't subscribed <br /> to any routine yet.
</p>
</div>
:
routines.map((id: any, index: number) => {
Expand Down
Loading

0 comments on commit 5018fd1

Please sign in to comment.