informer.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { Text} from 'app/design/typography'
  2. import { View } from 'app/design/view'
  3. import { useCurrentUser } from 'app/context/user'
  4. import { stripTags } from 'app/lib/util';
  5. import { fetcher } from 'app/lib/fetcher';
  6. import { useState, Fragment } from 'react';
  7. import { BlockWrapper } from 'app/components/block-wrapper'
  8. export default function ElementInformer({data, blockWrapperProps}) {
  9. const [ state, setState ] = useState(0);
  10. const { currentUser } = useCurrentUser();
  11. const pressBack = async () => {
  12. const sRequest = '/api.php?r=system/email_confirmation/TemplServiceAccount&resend[]=1';
  13. await fetcher(sRequest);
  14. setState(1);
  15. };
  16. if (!currentUser?.informer?.length)
  17. return null
  18. return (
  19. <BlockWrapper {...blockWrapperProps}>
  20. <View className="w-full mx-auto fixed bottom-16 lg:bottom-1 z-50">
  21. <View className=" w-full border-border/60 /50 mx-auto ">
  22. {currentUser?.informer?.map((item, index) => {
  23. if (item.id == 'sys-account-unconfirmed-email'){
  24. return <Fragment key={item.id}></Fragment>
  25. }
  26. if (item.id == 'sys-switch-profile-context' || item.id == 'sys-account-profile-system'){
  27. return <View key={'informer' + index}></View>
  28. }
  29. return (
  30. <View key={'informer' + index} className="max-w-screen-lg mx-auto bg-accent p-3 rounded-lg m-2 gap-y-3 justify-center items-center">
  31. <Text className="text-accent-foreground">{stripTags(item.msg)}</Text>
  32. </View>
  33. )
  34. })}
  35. </View>
  36. </View>
  37. </BlockWrapper>
  38. );
  39. }