Skip to content

[projects] Add 'New Workspace' context menu option to all Projects cards #6185

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

Merged
merged 2 commits into from
Oct 13, 2021
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
2 changes: 1 addition & 1 deletion components/dashboard/src/components/ContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function ContextMenu(props: ContextMenuProps) {
const menuId = String(Math.random());

// Default 'children' is the three dots hamburger button.
const children = props.children || <svg className="w-8 h-8 p-1 text-gray-600 dark:text-gray-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>Actions</title><g fill="currentColor" transform="rotate(90 12 12)"><circle cx="1" cy="1" r="2" transform="translate(5 11)" /><circle cx="1" cy="1" r="2" transform="translate(11 11)" /><circle cx="1" cy="1" r="2" transform="translate(17 11)" /></g></svg>;
const children = props.children || <svg className="w-8 h-8 p-1 rounded-md text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>Actions</title><g fill="currentColor" transform="rotate(90 12 12)"><circle cx="1" cy="1" r="2" transform="translate(5 11)" /><circle cx="1" cy="1" r="2" transform="translate(11 11)" /><circle cx="1" cy="1" r="2" transform="translate(17 11)" /></g></svg>;

return (
<div className="relative cursor-pointer">
Expand Down
21 changes: 14 additions & 7 deletions components/dashboard/src/projects/Projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,24 @@ export default function () {
{projects.filter(filter).sort(hasNewerPrebuild).map(p => (<div key={`project-${p.id}`} className="h-52">
<div className="h-42 border border-gray-100 dark:border-gray-800 rounded-t-xl">
<div className="h-32 p-6">
<div className="flex text-xl font-semibold text-gray-700 dark:text-gray-200 font-medium">
<div className="flex text-gray-700 dark:text-gray-200 font-medium">
<Link to={`/${teamOrUserSlug}/${p.name}`}>
{p.name}
<span className="text-xl font-semibold">{p.name}</span>
</Link>
<span className="flex-grow" />
<div className="justify-end">
<ContextMenu menuEntries={[{
title: "Remove Project",
customFontStyle: 'text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300',
onClick: () => onRemoveProject(p)
}]} />
<ContextMenu menuEntries={[
{
title: "New Workspace",
href: `/#${p.cloneUrl}`,
separator: true,
},
{
title: "Remove Project",
customFontStyle: 'text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300',
onClick: () => onRemoveProject(p)
},
]} />
</div>
</div>
<a href={p.cloneUrl.replace(/\.git$/, '')}>
Expand Down