mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-22 16:46:28 +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;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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() {
|
||||
const [isLoggedIn, setIsLoggedIn] = useState(false);
|
||||
const [uiState, setUIState] = useState('loading');
|
||||
__BENCHMARK.start('app-init');
|
||||
useLingui();
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -351,6 +372,7 @@ function App() {
|
|||
} else {
|
||||
setUIState('error');
|
||||
}
|
||||
__BENCHMARK.end('app-init');
|
||||
})();
|
||||
} else {
|
||||
window.__IGNORE_GET_ACCOUNT_ERROR__ = true;
|
||||
|
@ -393,6 +415,7 @@ function App() {
|
|||
} else {
|
||||
setUIState('default');
|
||||
}
|
||||
__BENCHMARK.end('app-init');
|
||||
}
|
||||
|
||||
// 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:1430
|
||||
#: src/pages/catchup.jsx:2051
|
||||
#: src/pages/settings.jsx:1028
|
||||
#: src/pages/settings.jsx:1045
|
||||
msgid "Boosts"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1251,7 +1251,7 @@ msgstr ""
|
|||
#: src/pages/home.jsx:223
|
||||
#: src/pages/mentions.jsx:20
|
||||
#: src/pages/mentions.jsx:167
|
||||
#: src/pages/settings.jsx:1020
|
||||
#: src/pages/settings.jsx:1037
|
||||
#: src/pages/trending.jsx:347
|
||||
msgid "Mentions"
|
||||
msgstr ""
|
||||
|
@ -1306,7 +1306,7 @@ msgstr ""
|
|||
#: src/pages/catchup.jsx:2045
|
||||
#: src/pages/favourites.jsx:11
|
||||
#: src/pages/favourites.jsx:23
|
||||
#: src/pages/settings.jsx:1024
|
||||
#: src/pages/settings.jsx:1041
|
||||
msgid "Likes"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2292,7 +2292,7 @@ msgid "<0/> <1/> boosted"
|
|||
msgstr ""
|
||||
|
||||
#: src/components/timeline.jsx:451
|
||||
#: src/pages/settings.jsx:1048
|
||||
#: src/pages/settings.jsx:1065
|
||||
msgid "New posts"
|
||||
msgstr ""
|
||||
|
||||
|
@ -3131,7 +3131,7 @@ msgid "{0, plural, one {Announcement} other {Announcements}}"
|
|||
msgstr ""
|
||||
|
||||
#: src/pages/notifications.jsx:599
|
||||
#: src/pages/settings.jsx:1036
|
||||
#: src/pages/settings.jsx:1053
|
||||
msgid "Follow requests"
|
||||
msgstr ""
|
||||
|
||||
|
@ -3486,56 +3486,56 @@ msgstr ""
|
|||
msgid "Unable to copy version string"
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/settings.jsx:933
|
||||
#: src/pages/settings.jsx:938
|
||||
#: src/pages/settings.jsx:950
|
||||
#: src/pages/settings.jsx:955
|
||||
msgid "Failed to update subscription. Please try again."
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/settings.jsx:944
|
||||
#: src/pages/settings.jsx:961
|
||||
msgid "Failed to remove subscription. Please try again."
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/settings.jsx:951
|
||||
#: src/pages/settings.jsx:968
|
||||
msgid "Push Notifications (beta)"
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/settings.jsx:973
|
||||
#: src/pages/settings.jsx:990
|
||||
msgid "Push notifications are blocked. Please enable them in your browser settings."
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/settings.jsx:982
|
||||
#: src/pages/settings.jsx:999
|
||||
msgid "Allow from <0>{0}</0>"
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/settings.jsx:991
|
||||
#: src/pages/settings.jsx:1008
|
||||
msgid "anyone"
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/settings.jsx:995
|
||||
#: src/pages/settings.jsx:1012
|
||||
msgid "people I follow"
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/settings.jsx:999
|
||||
#: src/pages/settings.jsx:1016
|
||||
msgid "followers"
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/settings.jsx:1032
|
||||
#: src/pages/settings.jsx:1049
|
||||
msgid "Follows"
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/settings.jsx:1040
|
||||
#: src/pages/settings.jsx:1057
|
||||
msgid "Polls"
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/settings.jsx:1044
|
||||
#: src/pages/settings.jsx:1061
|
||||
msgid "Post edits"
|
||||
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>."
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/settings.jsx:1081
|
||||
#: src/pages/settings.jsx:1098
|
||||
msgid "NOTE: Push notifications only work for <0>one account</0>."
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -826,6 +826,23 @@ function Settings({ onClose }) {
|
|||
</p>
|
||||
)}
|
||||
</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>
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue