Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tests for project view #444

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions apps/new/widget/components/project/ProfileCard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
const MutedText = styled.span`
color: #818181;

font-size: 16px;
font-style: normal;
font-weight: 400;
line-height: 20px; /* 125% */
`;

const AccountName = styled.span`
color: #818181;
font-size: 16px;
font-style: normal;
font-weight: 500;
line-height: 20px;

max-width: 30ch;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
`;

const ProfileCard = (props) => {
const accountId = props.accountId ?? context.accountId;
const link = props.link ?? true;
// const hideAccountId = props.hideAccountId;
// const hideName = props.hideName;
const hideImage = props.hideImage;
const iconOnly = props.iconOnly;
const openLinkInNewTab = props.openLinkInNewTab ?? false;

const profile = props.profile ?? Social.getr(`${accountId}/profile`);

const name = profile.name ?? accountId;
const title = props.title ?? `${name} @${accountId}`;
const tooltip =
props.tooltip && (props.tooltip === true ? title : props.tooltip);

let inner = (
<div className="d-flex flex-row justify-content-center align-items-center">
{!hideImage && (
<Widget
key="image"
src="${alias_mob}/widget/ProfileImage"
props={{
style: { width: "2.5em", height: "2.5em", marginRight: "0.3em" },
profile,
accountId,
className: "d-inline-block flex-shrink-0",
imageClassName: "rounded-circle w-100 h-100 align-top",
}}
/>
)}
{!iconOnly && (
<div className="d-flex flex-column gap-1">
<AccountName key="accountName">{name}</AccountName>
<AccountName key="accountId">@{accountId}</AccountName>
</div>
)}
</div>
);

inner = link ? (
<a
href={
link !== true
? link
: `/${REPL_MOB}/widget/ProfilePage?accountId=${accountId}`
}
target={openLinkInNewTab ? "_blank" : ""}
rel="noopener noreferrer"
className="link-dark text-truncate d-inline-flex"
>
{inner}
</a>
) : (
<span className="text-truncate d-inline-flex">{inner}</span>
);

if (props.tooltip === true) {
return (
<Widget
src="${REPL_MOB}/widget/Profile.OverlayTrigger"
props={{ accountId, children: inner }}
/>
);
}
if (tooltip) {
inner = (
<OverlayTrigger placement="auto" overlay={<Tooltip>{tooltip}</Tooltip>}>
{inner}
</OverlayTrigger>
);
}
return <div className="d-flex flex-row align-items-center">{inner}</div>;
};

return ProfileCard(props);
2 changes: 2 additions & 0 deletions apps/new/widget/page/project/TaskEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const task = props.task;
const onEditTask = props.onEditTask;
const onAddTask = props.onAddTask;
const project = props.project;
const isEditTask = props.isEditTask;

const [taskDetail, setTaskDetail] = useState(task);

Expand Down Expand Up @@ -136,6 +137,7 @@ return (
list: [...(taskDetail.list ?? []), { ...listItem }],
})
}
data-testid="add-task-item"
>
<i class="bi bi-plus-circle h5 pointer"></i>
</div>
Expand Down
4 changes: 3 additions & 1 deletion apps/new/widget/page/project/tabs/Task.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ const DropdownMenu = ({ columnTitle, item, index, changeStatusOptions }) => {
onBlur={() => handleDropdownToggle(columnTitle, index, false)}
>
<div
data-testid="task-dropdown"
data-bs-toggle="dropdown"
aria-expanded="false"
onClick={() => {
Expand Down Expand Up @@ -479,6 +480,7 @@ const AddTaskModal = useMemo(() => {
src="${config_account}/widget/page.project.TaskEditor"
props={{
showAddTaskModal: showAddTaskModal,
isEditTask: isEditTask,
task: taskDetail,
onEditTask: onEditTask,
onAddTask: onAddTask,
Expand Down Expand Up @@ -526,7 +528,7 @@ const ViewTaskModal = () => {
<div className="assignee-item" key={index}>
<Widget
src={
"devhub.near/widget/devhub.components.molecule.ProfileCard"
"${config_account}/widget/components.project.ProfileCard"
}
props={{
accountId: assignee,
Expand Down
2 changes: 1 addition & 1 deletion apps/old/widget/components/project/page/Task.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ const ViewTaskModal = () => {
<div className="assignee-item" key={index}>
<Widget
src={
"devhub.near/widget/devhub.components.molecule.ProfileCard"
"${config_account}/widget/components.project.ProfileCard"
}
props={{
accountId: assignee,
Expand Down
Loading
Loading