Skip to content

Commit

Permalink
Merge pull request #569 from stakwork/fix/slight_changes
Browse files Browse the repository at this point in the history
[BUG FIX] Trash Icon on Icons, and Image upload
  • Loading branch information
elraphty authored Jul 8, 2024
2 parents 633c370 + dfc7df0 commit b895186
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 49 deletions.
20 changes: 8 additions & 12 deletions src/pages/tickets/workspace/workspaceHeader/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect, useRef, useMemo } from 'react';
import React, { useState, useEffect, useRef, useMemo, useCallback } from 'react';
import { EuiCheckboxGroup, EuiPopover, EuiText } from '@elastic/eui';
import MaterialIcon from '@material/react-material-icon';
import { PostModal } from 'people/widgetViews/postBounty/PostModal';
Expand Down Expand Up @@ -98,18 +98,14 @@ export const WorkspaceHeader = ({

const closeSortByPopover = () => setIsSortByPopoverOpen(false);

useEffect(() => {
const checkUserPermissions = async () => {
const isLoggedIn = !!ui.meInfo;
const hasPermission =
isLoggedIn && (await userCanManageBounty(workspace_uuid, ui.meInfo?.pubkey, main));
setCanPostBounty(hasPermission);
};
const checkUserPermissions = useCallback(async () => {
const hasPermission = await userCanManageBounty(workspace_uuid, ui.meInfo?.pubkey, main);
setCanPostBounty(hasPermission);
}, [workspace_uuid, ui.meInfo, main]);

if (ui.meInfo && workspace_uuid) {
checkUserPermissions();
}
}, [ui.meInfo, workspace_uuid, main]);
useEffect(() => {
checkUserPermissions();
}, [checkUserPermissions]);

const selectedWidget = 'bounties';

Expand Down
28 changes: 2 additions & 26 deletions src/people/widgetViews/wantedViews/DesktopView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable func-style */
import React from 'react';
import { EuiButtonIcon, EuiText } from '@elastic/eui';
import { EuiText } from '@elastic/eui';
import { observer } from 'mobx-react-lite';
import { WantedViewsProps } from 'people/interfaces';
import StatusPill from '../parts/StatusPill';
Expand All @@ -9,7 +9,6 @@ import NameTag from '../../utils/NameTag';
import { useStores } from '../../../store';
import { formatPrice, satToUsd } from '../../../helpers';
import { Button, Divider } from '../../../components/common';
import { getHost } from '../../../config/host';
import { renderMarkdown } from '../../utils/RenderMarkdown';
import { Img, P, B, DT, DWrap, DescriptionCodeTask, Pad } from './style';

Expand All @@ -26,8 +25,6 @@ function DesktopView(props: WantedViewsProps) {
assignee,
estimated_session_length,
loomEmbedUrl,
showModal,
setDeletePayload,
key,
setExtrasPropertyAndSave,
saving,
Expand All @@ -42,7 +39,7 @@ function DesktopView(props: WantedViewsProps) {
titleString
} = props;

const { ui, main } = useStores();
const { main } = useStores();
const color = colors['light'];

return (
Expand Down Expand Up @@ -314,27 +311,6 @@ function DesktopView(props: WantedViewsProps) {
{estimated_session_length ?? ''}
</span>
</EuiText>
{ui?.meInfo?.isSuperAdmin && (
<EuiButtonIcon
onClick={(e: any) => {
e.stopPropagation();
if (showModal) showModal();
if (setDeletePayload)
setDeletePayload({
created: created,
host: getHost(),
pubkey: person.owner_pubkey
});
}}
iconType="trash"
aria-label="Next"
size="s"
style={{
color: `${color.pureBlack}`,
background: `${color.pureWhite}`
}}
/>
)}
</div>
</div>
</DWrap>
Expand Down
27 changes: 16 additions & 11 deletions src/store/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2133,18 +2133,23 @@ export class MainStore {
}

async uploadFile(body: FormData): Promise<null | Response> {
if (!uiStore.meInfo) return null;
const info = uiStore.meInfo;
const r: any = await fetch(`${TribesURL}/meme_upload`, {
method: 'POST',
mode: 'cors',
body,
headers: {
'x-jwt': info.tribe_jwt
}
});
try {
if (!uiStore.meInfo) return null;
const info = uiStore.meInfo;
const r: any = await fetch(`${TribesURL}/meme_upload`, {
method: 'POST',
mode: 'cors',
body,
headers: {
'x-jwt': info.tribe_jwt
}
});

return r;
return r;
} catch (e) {
console.log('Error uploading file', e);
return null;
}
}

async updateWorkspace(body: Workspace): Promise<any> {
Expand Down

0 comments on commit b895186

Please sign in to comment.