mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-21 21:29:20 +01:00
Add hidden debugging info
This commit is contained in:
parent
155abaa389
commit
d49c855a15
4 changed files with 81 additions and 19 deletions
22
src/app.css
22
src/app.css
|
@ -2907,3 +2907,25 @@ ul.link-list li a .icon {
|
||||||
width: 10em;
|
width: 10em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DEBUG */
|
||||||
|
|
||||||
|
.debug-info {
|
||||||
|
font-size: smaller;
|
||||||
|
summary {
|
||||||
|
height: 1em;
|
||||||
|
width: 100%;
|
||||||
|
list-style: none;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
summary::-webkit-details-marker {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
p,
|
||||||
|
ol,
|
||||||
|
ul {
|
||||||
|
margin-block-start: 0;
|
||||||
|
padding-block-start: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
23
src/app.jsx
23
src/app.jsx
|
@ -301,9 +301,30 @@ subscribe(states, (changes) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const BENCHES = new Map();
|
||||||
|
window.__BENCH_RESULTS = new Map();
|
||||||
|
window.__BENCHMARK = {
|
||||||
|
start(name) {
|
||||||
|
if (!import.meta.env.DEV) return;
|
||||||
|
const start = performance.now();
|
||||||
|
BENCHES.set(name, start);
|
||||||
|
},
|
||||||
|
end(name) {
|
||||||
|
if (!import.meta.env.DEV) return;
|
||||||
|
const start = BENCHES.get(name);
|
||||||
|
if (start) {
|
||||||
|
const end = performance.now();
|
||||||
|
const duration = end - start;
|
||||||
|
__BENCH_RESULTS.set(name, duration);
|
||||||
|
BENCHES.delete(name);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const [isLoggedIn, setIsLoggedIn] = useState(false);
|
const [isLoggedIn, setIsLoggedIn] = useState(false);
|
||||||
const [uiState, setUIState] = useState('loading');
|
const [uiState, setUIState] = useState('loading');
|
||||||
|
__BENCHMARK.start('app-init');
|
||||||
useLingui();
|
useLingui();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -351,6 +372,7 @@ function App() {
|
||||||
} else {
|
} else {
|
||||||
setUIState('error');
|
setUIState('error');
|
||||||
}
|
}
|
||||||
|
__BENCHMARK.end('app-init');
|
||||||
})();
|
})();
|
||||||
} else {
|
} else {
|
||||||
window.__IGNORE_GET_ACCOUNT_ERROR__ = true;
|
window.__IGNORE_GET_ACCOUNT_ERROR__ = true;
|
||||||
|
@ -393,6 +415,7 @@ function App() {
|
||||||
} else {
|
} else {
|
||||||
setUIState('default');
|
setUIState('default');
|
||||||
}
|
}
|
||||||
|
__BENCHMARK.end('app-init');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
|
|
38
src/locales/en.po
generated
38
src/locales/en.po
generated
|
@ -194,7 +194,7 @@ msgstr ""
|
||||||
#: src/pages/catchup.jsx:72
|
#: src/pages/catchup.jsx:72
|
||||||
#: src/pages/catchup.jsx:1430
|
#: src/pages/catchup.jsx:1430
|
||||||
#: src/pages/catchup.jsx:2051
|
#: src/pages/catchup.jsx:2051
|
||||||
#: src/pages/settings.jsx:1028
|
#: src/pages/settings.jsx:1045
|
||||||
msgid "Boosts"
|
msgid "Boosts"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -1251,7 +1251,7 @@ msgstr ""
|
||||||
#: src/pages/home.jsx:223
|
#: src/pages/home.jsx:223
|
||||||
#: src/pages/mentions.jsx:20
|
#: src/pages/mentions.jsx:20
|
||||||
#: src/pages/mentions.jsx:167
|
#: src/pages/mentions.jsx:167
|
||||||
#: src/pages/settings.jsx:1020
|
#: src/pages/settings.jsx:1037
|
||||||
#: src/pages/trending.jsx:347
|
#: src/pages/trending.jsx:347
|
||||||
msgid "Mentions"
|
msgid "Mentions"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -1306,7 +1306,7 @@ msgstr ""
|
||||||
#: src/pages/catchup.jsx:2045
|
#: src/pages/catchup.jsx:2045
|
||||||
#: src/pages/favourites.jsx:11
|
#: src/pages/favourites.jsx:11
|
||||||
#: src/pages/favourites.jsx:23
|
#: src/pages/favourites.jsx:23
|
||||||
#: src/pages/settings.jsx:1024
|
#: src/pages/settings.jsx:1041
|
||||||
msgid "Likes"
|
msgid "Likes"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -2292,7 +2292,7 @@ msgid "<0/> <1/> boosted"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/components/timeline.jsx:451
|
#: src/components/timeline.jsx:451
|
||||||
#: src/pages/settings.jsx:1048
|
#: src/pages/settings.jsx:1065
|
||||||
msgid "New posts"
|
msgid "New posts"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -3131,7 +3131,7 @@ msgid "{0, plural, one {Announcement} other {Announcements}}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/notifications.jsx:599
|
#: src/pages/notifications.jsx:599
|
||||||
#: src/pages/settings.jsx:1036
|
#: src/pages/settings.jsx:1053
|
||||||
msgid "Follow requests"
|
msgid "Follow requests"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -3486,56 +3486,56 @@ msgstr ""
|
||||||
msgid "Unable to copy version string"
|
msgid "Unable to copy version string"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:933
|
#: src/pages/settings.jsx:950
|
||||||
#: src/pages/settings.jsx:938
|
#: src/pages/settings.jsx:955
|
||||||
msgid "Failed to update subscription. Please try again."
|
msgid "Failed to update subscription. Please try again."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:944
|
#: src/pages/settings.jsx:961
|
||||||
msgid "Failed to remove subscription. Please try again."
|
msgid "Failed to remove subscription. Please try again."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:951
|
#: src/pages/settings.jsx:968
|
||||||
msgid "Push Notifications (beta)"
|
msgid "Push Notifications (beta)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:973
|
#: src/pages/settings.jsx:990
|
||||||
msgid "Push notifications are blocked. Please enable them in your browser settings."
|
msgid "Push notifications are blocked. Please enable them in your browser settings."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:982
|
#: src/pages/settings.jsx:999
|
||||||
msgid "Allow from <0>{0}</0>"
|
msgid "Allow from <0>{0}</0>"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:991
|
#: src/pages/settings.jsx:1008
|
||||||
msgid "anyone"
|
msgid "anyone"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:995
|
#: src/pages/settings.jsx:1012
|
||||||
msgid "people I follow"
|
msgid "people I follow"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:999
|
#: src/pages/settings.jsx:1016
|
||||||
msgid "followers"
|
msgid "followers"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:1032
|
#: src/pages/settings.jsx:1049
|
||||||
msgid "Follows"
|
msgid "Follows"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:1040
|
#: src/pages/settings.jsx:1057
|
||||||
msgid "Polls"
|
msgid "Polls"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:1044
|
#: src/pages/settings.jsx:1061
|
||||||
msgid "Post edits"
|
msgid "Post edits"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:1065
|
#: src/pages/settings.jsx:1082
|
||||||
msgid "Push permission was not granted since your last login. You'll need to <0><1>log in</1> again to grant push permission</0>."
|
msgid "Push permission was not granted since your last login. You'll need to <0><1>log in</1> again to grant push permission</0>."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:1081
|
#: src/pages/settings.jsx:1098
|
||||||
msgid "NOTE: Push notifications only work for <0>one account</0>."
|
msgid "NOTE: Push notifications only work for <0>one account</0>."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -826,6 +826,23 @@ function Settings({ onClose }) {
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</section>
|
</section>
|
||||||
|
{import.meta.env.DEV && (
|
||||||
|
<details class="debug-info">
|
||||||
|
<summary></summary>
|
||||||
|
<p>Debugging</p>
|
||||||
|
{__BENCH_RESULTS?.size > 0 && (
|
||||||
|
<ul>
|
||||||
|
{Array.from(__BENCH_RESULTS.entries()).map(
|
||||||
|
([name, duration]) => (
|
||||||
|
<li>
|
||||||
|
<b>{name}</b>: {duration}ms
|
||||||
|
</li>
|
||||||
|
),
|
||||||
|
)}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
</details>
|
||||||
|
)}
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue