Skip to content

Commit

Permalink
Rename next() and previous() to descriptive names
Browse files Browse the repository at this point in the history
  • Loading branch information
kubrysh committed Feb 20, 2023
1 parent a639760 commit 54697b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions orbitez/components/ServerSelector/ServerSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const ServerSelector = () => {
isLoading,
contractServers,
selectedServerIndex,
next,
previous
selectNextServer,
selectPreviousServer
} = useContractServersContext();

const loadingStateContent = useMemo(
Expand Down Expand Up @@ -43,7 +43,7 @@ const ServerSelector = () => {
return (
<>
<button
onClick={next}
onClick={selectNextServer}
className="server-selector__button"
disabled={areButtonsDisabled}
>
Expand Down Expand Up @@ -72,7 +72,7 @@ const ServerSelector = () => {
</ReactTooltip>
)}
<button
onClick={previous}
onClick={selectPreviousServer}
className="server-selector__button"
disabled={areButtonsDisabled}
>
Expand Down
8 changes: 4 additions & 4 deletions orbitez/hooks/useContractServers.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const useContractServers = () => {
setStatsUrl(selectedServerStatsUrl);
}, [contractServers, selectedServerIndex]);

const next = useCallback(() => {
const selectNextServer = useCallback(() => {
if (contractServers.length === selectedServerIndex + 1) {
setSelectedServerIndex(0);
return;
Expand All @@ -136,7 +136,7 @@ const useContractServers = () => {
setSelectedServerIndex(selectedServerIndex + 1);
}, [contractServers, selectedServerIndex]);

const previous = useCallback(() => {
const selectPreviousServer = useCallback(() => {
if (selectedServerIndex === 0) {
setSelectedServerIndex(contractServers.length - 1);
return;
Expand All @@ -154,8 +154,8 @@ const useContractServers = () => {
isLoading,
contractServers,
selectedServerIndex,
next,
previous
selectNextServer,
selectPreviousServer
}
};

Expand Down

0 comments on commit 54697b8

Please sign in to comment.