1
0
Fork 0
forked from OpenNeo/impress
impress/app/javascript/wardrobe-2020/WardrobePage/support/SupportOnly.js
Matchu 81b2a2b4a2 Bundle wardrobe-2020 into the app
We add jsbuilding-rails to get esbuild running in the app, and then we copy-paste the files we need from impress-2020 into here!

I stopped at the point where it was building successfully, but it's not running correctly: it's not sure about `process.env` in `next`, and I think the right next step is to delete the NextJS deps altogether and use React Router instead.
2023-10-23 19:05:08 -07:00

19 lines
637 B
JavaScript

import useSupport from "./useSupport";
/**
* SupportOnly only shows its contents to Support users. For most users, the
* content will be hidden!
*
* To become a Support user, you visit /?supportSecret=..., which saves the
* secret to your device.
*
* Note that this component doesn't check that the secret is *correct*, so it's
* possible to view this UI by faking an invalid secret. That's okay, because
* the server checks the provided secret for each Support request.
*/
function SupportOnly({ children }) {
const { isSupportUser } = useSupport();
return isSupportUser ? children : null;
}
export default SupportOnly;