mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-22 01:05:34 +03:00
s/setUiState/setUIState
This commit is contained in:
parent
d237fb8320
commit
635f4c1b0d
5 changed files with 26 additions and 26 deletions
|
@ -978,13 +978,13 @@ function TranslatedBioSheet({ note, fields, onClose }) {
|
|||
|
||||
function AddRemoveListsSheet({ accountID, onClose }) {
|
||||
const { masto } = api();
|
||||
const [uiState, setUiState] = useState('default');
|
||||
const [uiState, setUIState] = useState('default');
|
||||
const [lists, setLists] = useState([]);
|
||||
const [listsContainingAccount, setListsContainingAccount] = useState([]);
|
||||
const [reloadCount, reload] = useReducer((c) => c + 1, 0);
|
||||
|
||||
useEffect(() => {
|
||||
setUiState('loading');
|
||||
setUIState('loading');
|
||||
(async () => {
|
||||
try {
|
||||
const lists = await masto.v1.lists.list();
|
||||
|
@ -994,10 +994,10 @@ function AddRemoveListsSheet({ accountID, onClose }) {
|
|||
console.log({ lists, listsContainingAccount });
|
||||
setLists(lists);
|
||||
setListsContainingAccount(listsContainingAccount);
|
||||
setUiState('default');
|
||||
setUIState('default');
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
setUiState('error');
|
||||
setUIState('error');
|
||||
}
|
||||
})();
|
||||
}, [reloadCount]);
|
||||
|
@ -1028,7 +1028,7 @@ function AddRemoveListsSheet({ accountID, onClose }) {
|
|||
class={`light ${inList ? 'checked' : ''}`}
|
||||
disabled={uiState === 'loading'}
|
||||
onClick={() => {
|
||||
setUiState('loading');
|
||||
setUIState('loading');
|
||||
(async () => {
|
||||
try {
|
||||
if (inList) {
|
||||
|
@ -1040,11 +1040,11 @@ function AddRemoveListsSheet({ accountID, onClose }) {
|
|||
accountIds: [accountID],
|
||||
});
|
||||
}
|
||||
// setUiState('default');
|
||||
// setUIState('default');
|
||||
reload();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
setUiState('error');
|
||||
setUIState('error');
|
||||
alert(
|
||||
inList
|
||||
? 'Unable to remove from list.'
|
||||
|
|
|
@ -8,7 +8,7 @@ import MenuConfirm from './menu-confirm';
|
|||
|
||||
function ListAddEdit({ list, onClose }) {
|
||||
const { masto } = api();
|
||||
const [uiState, setUiState] = useState('default');
|
||||
const [uiState, setUIState] = useState('default');
|
||||
const editMode = !!list;
|
||||
const nameFieldRef = useRef();
|
||||
const repliesPolicyFieldRef = useRef();
|
||||
|
@ -49,7 +49,7 @@ function ListAddEdit({ list, onClose }) {
|
|||
repliesPolicy,
|
||||
exclusive,
|
||||
});
|
||||
setUiState('loading');
|
||||
setUIState('loading');
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
|
@ -70,14 +70,14 @@ function ListAddEdit({ list, onClose }) {
|
|||
}
|
||||
|
||||
console.log(listResult);
|
||||
setUiState('default');
|
||||
setUIState('default');
|
||||
onClose?.({
|
||||
state: 'success',
|
||||
list: listResult,
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
setUiState('error');
|
||||
setUIState('error');
|
||||
alert(
|
||||
editMode ? 'Unable to edit list.' : 'Unable to create list.',
|
||||
);
|
||||
|
@ -136,18 +136,18 @@ function ListAddEdit({ list, onClose }) {
|
|||
onClick={() => {
|
||||
// const yes = confirm('Delete this list?');
|
||||
// if (!yes) return;
|
||||
setUiState('loading');
|
||||
setUIState('loading');
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
await masto.v1.lists.remove(list.id);
|
||||
setUiState('default');
|
||||
setUIState('default');
|
||||
onClose?.({
|
||||
state: 'deleted',
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
setUiState('error');
|
||||
setUIState('error');
|
||||
alert('Unable to delete list.');
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -12,11 +12,11 @@ const LIMIT = 200;
|
|||
function FollowedHashtags() {
|
||||
const { masto, instance } = api();
|
||||
useTitle(`Followed Hashtags`, `/ft`);
|
||||
const [uiState, setUiState] = useState('default');
|
||||
const [uiState, setUIState] = useState('default');
|
||||
|
||||
const [followedHashtags, setFollowedHashtags] = useState([]);
|
||||
useEffect(() => {
|
||||
setUiState('loading');
|
||||
setUIState('loading');
|
||||
(async () => {
|
||||
try {
|
||||
const iterator = masto.v1.followedTags.list({
|
||||
|
@ -31,10 +31,10 @@ function FollowedHashtags() {
|
|||
tags.sort((a, b) => a.name.localeCompare(b.name));
|
||||
console.log(tags);
|
||||
setFollowedHashtags(tags);
|
||||
setUiState('default');
|
||||
setUIState('default');
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
setUiState('error');
|
||||
setUIState('error');
|
||||
}
|
||||
})();
|
||||
}, []);
|
||||
|
|
|
@ -14,21 +14,21 @@ import useTitle from '../utils/useTitle';
|
|||
function Lists() {
|
||||
const { masto } = api();
|
||||
useTitle(`Lists`, `/l`);
|
||||
const [uiState, setUiState] = useState('default');
|
||||
const [uiState, setUIState] = useState('default');
|
||||
|
||||
const [reloadCount, reload] = useReducer((c) => c + 1, 0);
|
||||
const [lists, setLists] = useState([]);
|
||||
useEffect(() => {
|
||||
setUiState('loading');
|
||||
setUIState('loading');
|
||||
(async () => {
|
||||
try {
|
||||
const lists = await masto.v1.lists.list();
|
||||
console.log(lists);
|
||||
setLists(lists);
|
||||
setUiState('default');
|
||||
setUIState('default');
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
setUiState('error');
|
||||
setUIState('error');
|
||||
}
|
||||
})();
|
||||
}, [reloadCount]);
|
||||
|
|
|
@ -28,7 +28,7 @@ function Search(props) {
|
|||
const { masto, instance, authenticated } = api({
|
||||
instance: params.instance,
|
||||
});
|
||||
const [uiState, setUiState] = useState('default');
|
||||
const [uiState, setUIState] = useState('default');
|
||||
const [searchParams] = useSearchParams();
|
||||
const searchFormRef = useRef();
|
||||
const q = props?.query || searchParams.get('q');
|
||||
|
@ -76,7 +76,7 @@ function Search(props) {
|
|||
};
|
||||
|
||||
function loadResults(firstLoad) {
|
||||
setUiState('loading');
|
||||
setUIState('loading');
|
||||
if (firstLoad && !type) {
|
||||
setStatusResults(statusResults.slice(0, SHORT_LIMIT));
|
||||
setAccountResults(accountResults.slice(0, SHORT_LIMIT));
|
||||
|
@ -116,10 +116,10 @@ function Search(props) {
|
|||
offsetRef.current = 0;
|
||||
setShowMore(false);
|
||||
}
|
||||
setUiState('default');
|
||||
setUIState('default');
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
setUiState('error');
|
||||
setUIState('error');
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue