Merge branch 'main' of github.com:jedmund/hensei-web
This commit is contained in:
commit
8877f3cfeb
5 changed files with 36 additions and 12 deletions
|
|
@ -10,14 +10,15 @@
|
||||||
min-width: 320px;
|
min-width: 320px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transition: opacity 0.3s ease-in-out;
|
|
||||||
|
|
||||||
&.visible {
|
&.visible {
|
||||||
|
transition: opacity 0.3s ease-in-out;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.hidden {
|
&.hidden {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
transition: opacity 0.12s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ interface Props {
|
||||||
fullAuto: boolean
|
fullAuto: boolean
|
||||||
autoGuard: boolean
|
autoGuard: boolean
|
||||||
favorited: boolean
|
favorited: boolean
|
||||||
|
loading: boolean
|
||||||
createdAt: Date
|
createdAt: Date
|
||||||
onClick: (shortcode: string) => void
|
onClick: (shortcode: string) => void
|
||||||
onSave?: (partyId: string, favorited: boolean) => void
|
onSave?: (partyId: string, favorited: boolean) => void
|
||||||
|
|
@ -74,6 +75,17 @@ const GridRep = (props: Props) => {
|
||||||
[styles.grid]: true,
|
[styles.grid]: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (props.loading) {
|
||||||
|
setVisible(false)
|
||||||
|
} else {
|
||||||
|
const timeout = setTimeout(() => {
|
||||||
|
setVisible(true)
|
||||||
|
}, 150)
|
||||||
|
return () => clearTimeout(timeout)
|
||||||
|
}
|
||||||
|
}, [props.loading])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setVisible(false) // Trigger fade out
|
setVisible(false) // Trigger fade out
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ const ProfileRoute: React.FC<Props> = ({
|
||||||
// Set up app-specific states
|
// Set up app-specific states
|
||||||
const [mounted, setMounted] = useState(false)
|
const [mounted, setMounted] = useState(false)
|
||||||
const [scrolled, setScrolled] = useState(false)
|
const [scrolled, setScrolled] = useState(false)
|
||||||
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
|
|
||||||
// Set up page-specific states
|
// Set up page-specific states
|
||||||
const [parties, setParties] = useState<Party[]>([])
|
const [parties, setParties] = useState<Party[]>([])
|
||||||
|
|
@ -142,6 +143,8 @@ const ProfileRoute: React.FC<Props> = ({
|
||||||
|
|
||||||
const fetchProfile = useCallback(
|
const fetchProfile = useCallback(
|
||||||
({ replace }: { replace: boolean }) => {
|
({ replace }: { replace: boolean }) => {
|
||||||
|
if (replace) setIsLoading(true)
|
||||||
|
|
||||||
const filters = {
|
const filters = {
|
||||||
params: {
|
params: {
|
||||||
element: element != -1 ? element : undefined,
|
element: element != -1 ? element : undefined,
|
||||||
|
|
@ -165,8 +168,10 @@ const ProfileRoute: React.FC<Props> = ({
|
||||||
setTotalPages(meta.total_pages)
|
setTotalPages(meta.total_pages)
|
||||||
setRecordCount(meta.count)
|
setRecordCount(meta.count)
|
||||||
|
|
||||||
if (replace) replaceResults(meta.count, results)
|
if (replace) {
|
||||||
else appendResults(results)
|
setIsLoading(false)
|
||||||
|
replaceResults(meta.count, results)
|
||||||
|
} else appendResults(results)
|
||||||
})
|
})
|
||||||
.catch((error) => handleError(error))
|
.catch((error) => handleError(error))
|
||||||
}
|
}
|
||||||
|
|
@ -261,6 +266,7 @@ const ProfileRoute: React.FC<Props> = ({
|
||||||
fullAuto={party.full_auto}
|
fullAuto={party.full_auto}
|
||||||
autoGuard={party.auto_guard}
|
autoGuard={party.auto_guard}
|
||||||
key={`party-${i}`}
|
key={`party-${i}`}
|
||||||
|
loading={isLoading}
|
||||||
onClick={goTo}
|
onClick={goTo}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ const SavedRoute: React.FC<Props> = ({
|
||||||
// Set up app-specific states
|
// Set up app-specific states
|
||||||
const [mounted, setMounted] = useState(false)
|
const [mounted, setMounted] = useState(false)
|
||||||
const [scrolled, setScrolled] = useState(false)
|
const [scrolled, setScrolled] = useState(false)
|
||||||
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
|
|
||||||
// Set up page-specific states
|
// Set up page-specific states
|
||||||
const [parties, setParties] = useState<Party[]>([])
|
const [parties, setParties] = useState<Party[]>([])
|
||||||
|
|
@ -140,6 +141,8 @@ const SavedRoute: React.FC<Props> = ({
|
||||||
|
|
||||||
const fetchTeams = useCallback(
|
const fetchTeams = useCallback(
|
||||||
({ replace }: { replace: boolean }) => {
|
({ replace }: { replace: boolean }) => {
|
||||||
|
if (replace) setIsLoading(true)
|
||||||
|
|
||||||
const filters: {
|
const filters: {
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
} = {
|
} = {
|
||||||
|
|
@ -169,8 +172,10 @@ const SavedRoute: React.FC<Props> = ({
|
||||||
setTotalPages(meta.total_pages)
|
setTotalPages(meta.total_pages)
|
||||||
setRecordCount(meta.count)
|
setRecordCount(meta.count)
|
||||||
|
|
||||||
if (replace) replaceResults(meta.count, results)
|
if (replace) {
|
||||||
else appendResults(results)
|
setIsLoading(false)
|
||||||
|
replaceResults(meta.count, results)
|
||||||
|
} else appendResults(results)
|
||||||
})
|
})
|
||||||
.catch((error) => handleError(error))
|
.catch((error) => handleError(error))
|
||||||
},
|
},
|
||||||
|
|
@ -300,6 +305,7 @@ const SavedRoute: React.FC<Props> = ({
|
||||||
fullAuto={party.full_auto}
|
fullAuto={party.full_auto}
|
||||||
autoGuard={party.auto_guard}
|
autoGuard={party.auto_guard}
|
||||||
key={`party-${i}`}
|
key={`party-${i}`}
|
||||||
|
loading={isLoading}
|
||||||
onClick={goTo}
|
onClick={goTo}
|
||||||
onSave={toggleFavorite}
|
onSave={toggleFavorite}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ const TeamsRoute: React.FC<Props> = ({
|
||||||
|
|
||||||
const fetchTeams = useCallback(
|
const fetchTeams = useCallback(
|
||||||
({ replace }: { replace: boolean }) => {
|
({ replace }: { replace: boolean }) => {
|
||||||
setIsLoading(true)
|
if (replace) setIsLoading(true)
|
||||||
|
|
||||||
const filters: {
|
const filters: {
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
|
|
@ -186,12 +186,10 @@ const TeamsRoute: React.FC<Props> = ({
|
||||||
setTotalPages(meta.total_pages)
|
setTotalPages(meta.total_pages)
|
||||||
setRecordCount(meta.count)
|
setRecordCount(meta.count)
|
||||||
|
|
||||||
if (replace) replaceResults(meta.count, results)
|
if (replace) {
|
||||||
else appendResults(results)
|
replaceResults(meta.count, results)
|
||||||
})
|
setIsLoading(false)
|
||||||
.then(() => {
|
} else appendResults(results)
|
||||||
console.log('You are here')
|
|
||||||
setIsLoading(false)
|
|
||||||
})
|
})
|
||||||
.catch((error) => handleError(error))
|
.catch((error) => handleError(error))
|
||||||
},
|
},
|
||||||
|
|
@ -321,6 +319,7 @@ const TeamsRoute: React.FC<Props> = ({
|
||||||
fullAuto={party.full_auto}
|
fullAuto={party.full_auto}
|
||||||
autoGuard={party.auto_guard}
|
autoGuard={party.auto_guard}
|
||||||
key={`party-${i}`}
|
key={`party-${i}`}
|
||||||
|
loading={isLoading}
|
||||||
onClick={goTo}
|
onClick={goTo}
|
||||||
onSave={toggleFavorite}
|
onSave={toggleFavorite}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue