Skip to content

Commit

Permalink
feat(UQ-1853): changed admin
Browse files Browse the repository at this point in the history
  • Loading branch information
Cleberton Junior committed Jan 12, 2023
1 parent 9d37800 commit 2590100
Show file tree
Hide file tree
Showing 79 changed files with 4,276 additions and 1,518 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish

on:
push:
branches:
- main
tags:
- "!v[0-9]+.[0-9]+.[0-9]+"

jobs:
deploy:
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.npmToken }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile --no-progress

- name: Build
run: yarn prepublish:latest

- name: Run release command
run: yarn release
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ In our minimum support we're following [official Node.js releases timelines](htt
> This plugin is designed for **Strapi v4** and is not working with v3.x. To get version for **Strapi v3** install version [v1.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments/tree/strapi-v3).
**Plugin dependencies**
- `@strapi/plugin-graphql` - required to run because built-in support for GraphQL handled by this plugin

- `@strapi/plugin-graphql` - required to run because built-in support for GraphQL handled by this plugin

**We recommend always using the latest version of Strapi to start your new projects**.

Expand Down
31 changes: 17 additions & 14 deletions __mocks__/initSetup.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { get, set, pick, isEmpty } from "lodash";


// @ts-ignore
const mockStrapi = (config: any = {}, toStore: boolean = false, database: any = {}) => {
const mockStrapi = (
config: any = {},
toStore: boolean = false,
database: any = {}
) => {
const dbConfig = toStore
? {
plugin: {
Expand Down Expand Up @@ -110,17 +113,17 @@ const mockStrapi = (config: any = {}, toStore: boolean = false, database: any =
},
services: {
email: {
send: async () => { }
}
}
send: async () => {},
},
},
},
graphql: {},
"users-permissions": {
contentTypes: {
user: {
uid: 'plugin::users-permissions.user',
}
}
uid: "plugin::users-permissions.user",
},
},
},
},
config: {
Expand All @@ -141,11 +144,11 @@ const mockStrapi = (config: any = {}, toStore: boolean = false, database: any =
},
},
contentTypes: {
'plugin::users-permissions.user': {
uid: 'plugin::users-permissions.user',
attributes: {}
}
}
"plugin::users-permissions.user": {
uid: "plugin::users-permissions.user",
attributes: {},
},
},
};

if (!isEmpty(database)) {
Expand All @@ -167,4 +170,4 @@ export const setupStrapi = (config = {}, toStore = false, database = {}) => {
value: mockStrapi(config, toStore, database),
writable: true,
});
};
};
28 changes: 14 additions & 14 deletions admin/src/components/AdminAvatar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import React from "react";
import { AdminAvatarWrapper, AdminShield } from "./styles";
// @ts-ignore
import {Shield} from "@strapi/icons";
import { Shield } from "@strapi/icons";
// @ts-ignore
import {Icon} from "@strapi/design-system/Icon";
import { Icon } from "@strapi/design-system/Icon";

const AdminAvatar: React.FC<React.PropsWithChildren<{}>> = ({ children } ) => {
return (
<AdminAvatarWrapper>
<AdminShield>
<Icon as={Shield} color="neutral800"/>
</AdminShield>
{children}
</AdminAvatarWrapper>
);
}
export default AdminAvatar;
const AdminAvatar: React.FC<React.PropsWithChildren<{}>> = ({ children }) => {
return (
<AdminAvatarWrapper>
<AdminShield>
<Icon as={Shield} color="neutral800" />
</AdminShield>
{children}
</AdminAvatarWrapper>
);
};

export default AdminAvatar;
10 changes: 5 additions & 5 deletions admin/src/components/AdminAvatar/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import styled from "styled-components";
import { Box } from "@strapi/design-system/Box";

export const AdminAvatarWrapper = styled(Box)`
position: relative;
position: relative;
`;

export const AdminShield = styled(Box)`
position: absolute;
right: -30%;
top: -30%;
`;
position: absolute;
right: -30%;
top: -30%;
`;
35 changes: 22 additions & 13 deletions admin/src/components/Avatar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,34 @@ import AdminAvatar from "../AdminAvatar";
import { ToBeFixed } from "../../../../types";

interface IProps {
avatar: string | ToBeFixed;
name: string;
isAdminComment?: boolean;
};
avatar: string | ToBeFixed;
name: string;
isAdminComment?: boolean;
}

const UserAvatar: React.FC<IProps> = ({ avatar, name, isAdminComment = false }) => {
const UserAvatar: React.FC<IProps> = ({
avatar,
name,
isAdminComment = false,
}) => {
if (avatar) {
let image = avatar;
if (isObject(avatar)) {
image = avatar?.formats?.thumbnail.url || avatar.url;
}
return(
isAdminComment ? <AdminAvatar>{image && (<Avatar src={image} alt={name} />)}</AdminAvatar>
: image && (<Avatar src={image} alt={name} />))
}
return(
isAdminComment ? <AdminAvatar>{name && (<Initials>{renderInitials(name)}</Initials>)}</AdminAvatar>
: name && (<Initials>{renderInitials(name)}</Initials>)
)
return isAdminComment ? (
<AdminAvatar>{image && <Avatar src={image} alt={name} />}</AdminAvatar>
) : (
image && <Avatar src={image} alt={name} />
);
}
return isAdminComment ? (
<AdminAvatar>
{name && <Initials>{renderInitials(name)}</Initials>}
</AdminAvatar>
) : (
name && <Initials>{renderInitials(name)}</Initials>
);
};

export default UserAvatar;
9 changes: 4 additions & 5 deletions admin/src/components/CommentReviewModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
// TODO
// @ts-nocheck

import React from 'react';
import PropTypes from 'prop-types';
import React from "react";
import PropTypes from "prop-types";
import {
ModalLayout,
ModalBody,
ModalHeader,
ModalFooter,
} from '@strapi/design-system/ModalLayout';
} from "@strapi/design-system/ModalLayout";
import { Typography } from "@strapi/design-system/Typography";
import { getMessage } from "../../utils";
import DiscussionThreadItem from "../DiscussionThreadItem";
Expand All @@ -33,7 +33,7 @@ const CommentReviewModal = ({
<Typography fontWeight="bold" textColor="neutral800" as="h2" id="title">
{getMessage(
"page.details.panel.discussion.warnings.comments.header",
"Open reports",
"Open reports"
)}
</Typography>
</ModalHeader>
Expand All @@ -55,5 +55,4 @@ const CommentReviewModal = ({
</ModalLayout>
);


export default CommentReviewModal;
5 changes: 1 addition & 4 deletions admin/src/components/DiscussionThread/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ const DiscussionThread = ({
{getMessage("page.details.panel.discussion", "Discussion")}
</Typography>
{rootThread && (
<Link
to={getUrl(`discover/${rootThread.id}`)}
startIcon={arrowUp}
>
<Link to={getUrl(`discover/${rootThread.id}`)} startIcon={arrowUp}>
{getMessage("page.details.panel.discussion.nav.back")}
</Link>
)}
Expand Down
Loading

0 comments on commit 2590100

Please sign in to comment.