Skip to content

Commit

Permalink
Merge pull request #53 from gentlementlegen/chore/new-assign-design
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 authored Sep 19, 2024
2 parents 06592fd + 7ccec7f commit c8de57e
Show file tree
Hide file tree
Showing 5 changed files with 664 additions and 571 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"description": "Unassign yourself from the issue."
}
}
}
}
11 changes: 5 additions & 6 deletions src/handlers/shared/generate-assignment-comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ export async function generateAssignmentComment(context: Context, issueCreatedAt
registeredWallet:
(await context.adapters.supabase.user.getWalletByUserId(senderId, issueNumber)) ||
"Register your wallet address using the following slash command: `/wallet 0x0000...0000`",
tips: `<h6>Tips:</h6>
<ul>
<li>Use <code>/wallet 0x0000...0000</code> if you want to update your registered payment wallet address.</li>
<li>Be sure to open a draft pull request as soon as possible to communicate updates on your progress.</li>
<li>Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.</li>
<ul>`,
tips: `
> [!TIP]
> - Use <code>/wallet 0x0000...0000</code> if you want to update your registered payment wallet address.
> - Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
> - Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.`,
};
}
29 changes: 13 additions & 16 deletions src/handlers/shared/table.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
export function assignTableComment({ taskDeadline, registeredWallet, isTaskStale, daysElapsedSinceTaskCreation }: AssignTableCommentParams) {
let taskStaleWarning = ``;
const elements: string[] = ["<samp>", "<table>"];

if (isTaskStale) {
taskStaleWarning = `<tr><td>Warning!</td> <td>This task was created over ${daysElapsedSinceTaskCreation} days ago. Please confirm that this issue specification is accurate before starting.</td></tr>`;
elements.push(
"<tr>",
"<td>Warning!</td>",
`<td><This task was created over ${daysElapsedSinceTaskCreation} days ago. Please confirm that this issue specification is accurate before starting.</td>`,
"</tr>"
);
}
let deadlineWarning = ``;

if (taskDeadline) {
deadlineWarning = `<tr><td>Deadline</td><td>${taskDeadline}</td></tr>`;
elements.push("<tr>", "<td>Deadline</td>", `<td>${taskDeadline}</td>`, "</tr>");
}

return `
<samp>
<table>
${taskStaleWarning}
${deadlineWarning}
<tr>
<td>Beneficiary</td>
<td>${registeredWallet}</td>
</tr>
</table>
</samp>
`;
elements.push("<tr>", "<td>Beneficiary</td>", `<td>${registeredWallet}</td>`, "</tr>", "</table>", "</samp>");

return elements.join("\n");
}

interface AssignTableCommentParams {
Expand Down
2 changes: 1 addition & 1 deletion tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ describe("User start/stop", () => {
errorDetails.push(`${error.path}: ${error.message}`);
}

expect(errorDetails).toContain("/BOT_USER_ID: Required property");
expect(errorDetails).toContain("/BOT_USER_ID: Expected union value");
}
});

Expand Down
Loading

0 comments on commit c8de57e

Please sign in to comment.