How to use the contexts.useContentContext function in contexts

To help you get started, we’ve selected a few contexts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mikey1384 / twinkle-network / source / containers / App / index.js View on Github external
},
    requestHelpers: { auth, initSession, uploadFileOnChat }
  } = useAppContext();
  const { signinModalShown, username } = useMyState();
  const {
    actions: {
      onPostFileUploadStatus,
      onPostUploadComplete,
      onResetChat,
      onSendFirstDirectMessage,
      onUpdateClientToApiServerProgress
    }
  } = useChatContext();
  const {
    actions: { onInitContent }
  } = useContentContext();
  const {
    state: { updateDetail, updateNoticeShown }
  } = useNotiContext();
  const {
    state: { pageVisible },
    actions: { onChangePageVisibility }
  } = useViewContext();
  const [mobileMenuShown, setMobileMenuShown] = useState(false);
  const visibilityChangeRef = useRef(null);
  const hiddenRef = useRef(null);
  const authRef = useRef(null);
  const mounted = useRef(true);

  useEffect(() => {
    mounted.current = true;
    return function cleanUp() {
github mikey1384 / twinkle-network / source / containers / Home / index.js View on Github external
export default function Home({ history, location }) {
  const {
    requestHelpers: { uploadProfilePic }
  } = useAppContext();
  const {
    actions: { onUploadProfilePic }
  } = useContentContext();
  const { userId } = useMyState();
  const [alertModalShown, setAlertModalShown] = useState(false);
  const [imageEditModalShown, setImageEditModalShown] = useState(false);
  const [imageUri, setImageUri] = useState(null);
  const [processing, setProcessing] = useState(false);

  return (
    
      <div>
        <div>
           setAlertModalShown(true)}
            onLoadImage={upload =&gt; {
              setImageEditModalShown(true);
              setImageUri(upload.target.result);</div></div>
github mikey1384 / twinkle-network / source / containers / Profile / Body / Home / index.js View on Github external
onDeleteComment,
      onEditComment,
      onEditRewardComment,
      onLikeComment,
      onLoadComments,
      onLoadMoreComments,
      onLoadMoreReplies,
      onLoadRepliesOfReply,
      onUpdateStatusMsg,
      onUploadComment,
      onUploadReply,
      onRemoveStatusMsg,
      onUpdateGreeting,
      onUpdateBio
    }
  } = useContentContext();
  const {
    state: { editedStatusMsg, editedStatusColor },
    actions: { onSetEditedStatusColor, onSetEditedStatusMsg }
  } = useInputContext();
  const {
    commentsLoaded,
    email,
    emailVerified,
    greeting,
    id,
    joinDate,
    lastActive,
    online,
    statusMsg,
    profileFirstRow,
    profileSecondRow,
github mikey1384 / twinkle-network / source / containers / VideoPage / Details / index.js View on Github external
onSetRewardLevel,
  stars,
  timeStamp,
  videoId,
  videoViews
}) {
  const {
    authLevel,
    canDelete,
    canEdit,
    canEditPlaylists,
    canStar
  } = useMyState();
  const {
    actions: { onSetIsEditing, onSetXpRewardInterfaceShown }
  } = useContentContext();
  const {
    state: inputState,
    actions: { onSetEditForm }
  } = useInputContext();
  const { isEditing, xpRewardInterfaceShown } = useContentState({
    contentType: 'video',
    contentId: videoId
  });
  const [titleHovered, setTitleHovered] = useState(false);
  const TitleRef = useRef(null);
  const RewardInterfaceRef = useRef(null);

  useEffect(() => {
    if (!inputState['edit' + 'video' + videoId]) {
      onSetEditForm({
        contentId: videoId,
github mikey1384 / twinkle-network / source / components / Comments / Replies / Reply.js View on Github external
deleteReply,
  loadRepliesOfReply,
  parent,
  reply,
  reply: { likes = [], stars = [], uploader },
  rootContent,
  submitReply,
  subject
}) {
  const {
    requestHelpers: { editContent, loadReplies }
  } = useAppContext();
  const { authLevel, canDelete, canEdit, canStar, userId } = useMyState();
  const {
    actions: { onSetIsEditing, onSetXpRewardInterfaceShown }
  } = useContentContext();
  const { deleted, isEditing, xpRewardInterfaceShown } = useContentState({
    contentType: 'comment',
    contentId: reply.id
  });
  const {
    onAttachStar,
    onEditDone,
    onLikeClick,
    onRewardCommentEdit
  } = useContext(LocalContext);
  const [userListModalShown, setUserListModalShown] = useState(false);
  const [confirmModalShown, setConfirmModalShown] = useState(false);
  const ReplyInputAreaRef = useRef(null);
  const RewardInterfaceRef = useRef(null);
  const userIsUploader = userId === uploader.id;
  const userIsHigherAuth = authLevel > uploader.authLevel;
github mikey1384 / twinkle-network / source / components / VideoPlayer.js View on Github external
const {
    state: { pageVisible }
  } = useViewContext();
  const {
    actions: {
      onChangeUserXP,
      onSetVideoImageUrl,
      onSetVideoStarted,
      onSetVideoXpEarned,
      onSetVideoXpJustEarned,
      onSetVideoXpLoaded,
      onSetVideoXpProgress,
      onSetXpVideoWatchTime,
      onSetVideoCurrentTime
    }
  } = useContentContext();
  const {
    currentTime = 0,
    started,
    xpLoaded,
    xpEarned,
    justEarned,
    imageUrl = '',
    progress = 0,
    watchTime = 0,
    isEditing
  } = useContentState({ contentType: 'video', contentId: videoId });
  const [playing, setPlaying] = useState(false);
  const [alreadyEarned, setAlreadyEarned] = useState(false);
  const [startingPosition, setStartingPosition] = useState(0);
  const [timeAt, setTimeAt] = useState(0);
  const maxRequiredDuration = 250;
github mikey1384 / twinkle-network / source / components / ContentPanel / TargetContent / Comment.js View on Github external
export default function Comment({
  comment,
  comment: { id, content, timeStamp },
  onDelete,
  onEditDone,
  profilePicId,
  userId,
  username
}) {
  const {
    requestHelpers: { deleteContent, editContent }
  } = useAppContext();
  const {
    actions: { onSetIsEditing }
  } = useContentContext();
  const { isEditing } = useContentState({
    contentType: 'comment',
    contentId: id
  });
  const [confirmModalShown, setConfirmModalShown] = useState(false);
  return (
    
      {!isEditing &amp;&amp; (
github mikey1384 / twinkle-network / source / components / RewardStatus / Comment.js View on Github external
export default function Comment({
  maxRewardableStars,
  noMarginForEditButton,
  onEditDone = () => {},
  star
}) {
  const {
    requestHelpers: { editRewardComment }
  } = useAppContext();
  const {
    actions: { onSetIsEditing }
  } = useContentContext();
  const { authLevel, canEdit, userId } = useMyState();
  const { isEditing } = useContentState({
    contentType: 'reward',
    contentId: star.id
  });
  const userIsUploader = star.rewarderId === userId;
  const userCanEditThis = canEdit && authLevel > star.rewarderAuthLevel;
  const editButtonShown = userIsUploader || userCanEditThis;
  const editMenuItems = [];
  if (userIsUploader || canEdit) {
    editMenuItems.push({
      label: 'Edit',
      onClick: () =>
        onSetIsEditing({
          contentId: star.id,
          contentType: 'reward',

contexts

ISC
Latest version published 8 years ago

Package Health Score

40 / 100
Full package analysis