EditInfo.tsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import { Typography } from "antd";
  2. import { Space } from "antd";
  3. import StudioName from "../../auth/StudioName";
  4. import User from "../../auth/User";
  5. import Channel from "../../channel/Channel";
  6. import TimeShow from "../../general/TimeShow";
  7. import { ISentence } from "../SentEdit";
  8. const { Text } = Typography;
  9. interface IDetailsWidget {
  10. data: ISentence;
  11. isPr?: boolean;
  12. }
  13. export const Details = ({ data, isPr }: IDetailsWidget) => (
  14. <Space wrap>
  15. <Channel {...data.channel} />
  16. <User {...data.editor} showAvatar={isPr ? true : false} />
  17. {data.prEditAt ? (
  18. <TimeShow
  19. type="secondary"
  20. updatedAt={data.prEditAt}
  21. createdAt={data.createdAt}
  22. />
  23. ) : (
  24. <TimeShow
  25. type="secondary"
  26. updatedAt={data.updateAt}
  27. createdAt={data.createdAt}
  28. />
  29. )}
  30. {data.acceptor ? <User {...data.acceptor} showAvatar={false} /> : undefined}
  31. {data.acceptor ? "accept at" : undefined}
  32. {data.prEditAt ? (
  33. <TimeShow type="secondary" updatedAt={data.updateAt} showLabel={false} />
  34. ) : undefined}
  35. </Space>
  36. );
  37. interface IWidget {
  38. data: ISentence;
  39. isPr?: boolean;
  40. compact?: boolean;
  41. }
  42. const EditInfoWidget = ({ data, isPr = false, compact = false }: IWidget) => {
  43. //console.log("data.createdAt", data.createdAt, data.updateAt);
  44. return (
  45. <div style={{ fontSize: "80%" }}>
  46. <Text type="secondary">
  47. <Space>
  48. {compact ? undefined : <Details data={data} isPr={isPr} />}
  49. </Space>
  50. </Text>
  51. </div>
  52. );
  53. };
  54. export default EditInfoWidget;