Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Feature/confluence settings #211

Merged
merged 29 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4580273
Make all unlogged services lose title
EstebanDalelR Jul 24, 2023
01eebf2
Create watermelon.ts
EstebanDalelR Jul 24, 2023
ee7a85b
Use standard type
EstebanDalelR Jul 24, 2023
abb5bba
use standard types
EstebanDalelR Jul 24, 2023
75f1401
Use standard types
EstebanDalelR Jul 25, 2023
7f3e698
Create general case helper
EstebanDalelR Jul 25, 2023
7e1fcb6
Make code more readable
EstebanDalelR Jul 25, 2023
d3feab1
Merge branch 'chore/readableMarkdownHelpers' into feature/standardAPI…
EstebanDalelR Jul 25, 2023
df5530d
Allow number to be a string, like a slack channel
EstebanDalelR Jul 25, 2023
07520cb
Add possible body
EstebanDalelR Jul 25, 2023
a29d528
Standardize helpers
EstebanDalelR Jul 25, 2023
b8c36a3
Remove unused helpers
EstebanDalelR Jul 25, 2023
f73ea24
Add possible image element
EstebanDalelR Jul 25, 2023
edd4544
Remove unused code
EstebanDalelR Jul 25, 2023
169b786
use standard response
EstebanDalelR Jul 25, 2023
5bbb140
remove logging, fix text
EstebanDalelR Jul 25, 2023
fc030ac
Fix token errors in confluence
EstebanDalelR Jul 25, 2023
83f245a
Better responses on success and failure
EstebanDalelR Jul 25, 2023
ed0e601
Check nulls
EstebanDalelR Jul 25, 2023
5394ccc
Add max results
EstebanDalelR Jul 25, 2023
e8160a6
Add limit using amount
EstebanDalelR Jul 25, 2023
0e9c71b
create StandardAPIInput
EstebanDalelR Jul 25, 2023
0da321d
Fix type
EstebanDalelR Jul 25, 2023
8a118c6
Create OptionDropdown component
EstebanDalelR Jul 25, 2023
1ae6fd6
Change to max 5
EstebanDalelR Jul 25, 2023
8ac7d0d
Fix code
EstebanDalelR Jul 25, 2023
315fc17
Make it component based, add confluence
EstebanDalelR Jul 25, 2023
81ae7b3
Remove component unused
EstebanDalelR Jul 25, 2023
d9bcc07
Fix loading page
EstebanDalelR Jul 25, 2023
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
194 changes: 85 additions & 109 deletions app/settings/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default function form({ userEmail }) {
GitHubPRs: 3,
NotionPages: 3,
LinearTickets: 3,
ConfluenceDocs: 3,
AISummary: 1,
});
const handleSubmit = async () => {
Expand Down Expand Up @@ -50,120 +51,94 @@ export default function form({ userEmail }) {
setUserSettingsState(userEmail);
}, [userEmail]);

return (
<form>
<div className="">
<span>Jira Tickets: </span>
<select
className="form-select"
aria-label="Amount of Jira Tickets"
defaultValue={formState?.JiraTickets}
onChange={(e) =>
setFormState({
...formState,
JiraTickets: parseInt(e.target.value),
})
}
value={formState.JiraTickets}
>
{Array.from(Array(11)).map((i, index) => {
if (index === 0) {
return null;
}
return <option value={index}>{index}</option>;
})}
</select>
</div>
function SettingsSelector({ label, value, onChange, defaultValue }) {
return (
<div className="">
<span>Slack Messages: </span>
<span>{label}</span>
<select
className="form-select"
aria-label="Amount of Slack Messages"
defaultValue={formState?.SlackMessages}
value={formState.SlackMessages}
onChange={(e) =>
setFormState({
...formState,
SlackMessages: parseInt(e.target.value),
})
}
aria-label={label}
defaultValue={defaultValue}
onChange={onChange}
value={value}
>
{Array.from(Array(11)).map((i, index) => {
if (index === 0) {
return null;
}
return <option value={index}>{index}</option>;
})}
</select>
</div>
<div className="">
<span>GitHub PRs: </span>
<select
className="form-select"
aria-label="Amount of GitHub PRs"
defaultValue={formState?.GitHubPRs}
value={formState.GitHubPRs}
onChange={(e) =>
setFormState({
...formState,
GitHubPRs: parseInt(e.target.value),
})
}
>
{Array.from(Array(11)).map((i, index) => {
if (index === 0) {
return null;
}
return <option value={index}>{index}</option>;
})}
</select>
</div>

<div className="">
<span>Notion Pages:</span>
<select
className="form-select"
aria-label="Amount of Notion Pages"
defaultValue={formState?.NotionPages}
value={formState.NotionPages}
onChange={(e) =>
setFormState({
...formState,
NotionPages: parseInt(e.target.value),
})
}
>
{Array.from(Array(11)).map((i, index) => {
if (index === 0) {
return null;
}
return <option value={index}>{index}</option>;
})}
</select>
</div>

<div className="">
<span>Linear Tickets:</span>
<select
className="form-select"
aria-label="Amount of Linear Tickets"
defaultValue={formState?.LinearTickets}
value={formState.LinearTickets}
onChange={(e) =>
setFormState({
...formState,
LinearTickets: parseInt(e.target.value),
})
}
>
{Array.from(Array(6)).map((i, index) => {
if (index === 0) {
return null;
}
return <option value={index}>{index}</option>;
})}
{Array.from({ length: 5 }, (_, index) => (
<option key={index} value={index + 1}>
{index + 1}
</option>
))}
</select>
</div>
);
}
return (
<form>
<SettingsSelector
label="Jira Tickets"
value={formState.JiraTickets}
onChange={(e) =>
setFormState({
...formState,
JiraTickets: parseInt(e.target.value),
})
}
defaultValue={formState?.JiraTickets}
/>
<SettingsSelector
label="Slack Messages"
value={formState.SlackMessages}
onChange={(e) =>
setFormState({
...formState,
SlackMessages: parseInt(e.target.value),
})
}
defaultValue={formState?.SlackMessages}
/>
<SettingsSelector
label="GitHub PRs"
value={formState.GitHubPRs}
onChange={(e) =>
setFormState({
...formState,
GitHubPRs: parseInt(e.target.value),
})
}
defaultValue={formState?.GitHubPRs}
/>
<SettingsSelector
label="Notion Pages"
value={formState.NotionPages}
onChange={(e) =>
setFormState({
...formState,
NotionPages: parseInt(e.target.value),
})
}
defaultValue={formState?.NotionPages}
/>
<SettingsSelector
label="Linear Tickets"
value={formState.LinearTickets}
onChange={(e) =>
setFormState({
...formState,
LinearTickets: parseInt(e.target.value),
})
}
defaultValue={formState?.LinearTickets}
/>
<SettingsSelector
label="Confluence Docs"
value={formState.ConfluenceDocs}
onChange={(e) =>
setFormState({
...formState,
ConfluenceDocs: parseInt(e.target.value),
})
}
defaultValue={formState?.ConfluenceDocs}
/>

<div className="">
<span>AI Summary: </span>
Expand All @@ -179,7 +154,8 @@ export default function form({ userEmail }) {
})
}
>
<option value={1}>Active</option>;<option value={0}>Inactive</option>;
<option value={1}>Active</option>
<option value={0}>Inactive</option>
</select>
</div>
<button
Expand Down
118 changes: 49 additions & 69 deletions app/settings/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,23 @@ async function Settings({}) {
SlackMessages: 3,
GitHubPRs: 3,
NotionPages: 3,
LinearTickets: 3,
ConfluenceDocs: 3,
AISummary: 1,
};
function SettingsSelector({ label, value, defaultValue }) {
return (
<div className="">
<span>{label}</span>
<select
className="form-select"
aria-label={label}
defaultValue={defaultValue}
value={value}
></select>
</div>
);
}
return (
<div>
<div className="p-3">
Expand All @@ -29,71 +44,36 @@ async function Settings({}) {
</div>
</div>
<form>
<div className="">
<span>Jira Tickets: </span>
<select
className="form-select"
aria-label="Amount of Jira Tickets"
defaultValue={formState?.JiraTickets}
value={formState.JiraTickets}
>
{Array.from(Array(6)).map((i, index) => {
if (index === 0) {
return null;
}
return <option value={index}>{index}</option>;
})}
</select>
</div>
<div className="">
<span>Slack Messages: </span>
<select
className="form-select"
aria-label="Amount of Slack Messages"
defaultValue={formState?.SlackMessages}
value={formState.SlackMessages}
>
{Array.from(Array(6)).map((i, index) => {
if (index === 0) {
return null;
}
return <option value={index}>{index}</option>;
})}
</select>
</div>
<div className="">
<span>GitHub PRs: </span>
<select
className="form-select"
aria-label="Amount of GitHub PRs"
defaultValue={formState?.GitHubPRs}
value={formState.GitHubPRs}
>
{Array.from(Array(6)).map((i, index) => {
if (index === 0) {
return null;
}
return <option value={index}>{index}</option>;
})}
</select>
</div>

<div className="">
<span>Notion Pages:</span>
<select
className="form-select"
aria-label="Amount of Notion Pages"
defaultValue={formState?.NotionPages}
value={formState.NotionPages}
>
{Array.from(Array(6)).map((i, index) => {
if (index === 0) {
return null;
}
return <option value={index}>{index}</option>;
})}
</select>
</div>
<SettingsSelector
label="Jira Tickets"
value={formState.JiraTickets}
defaultValue={formState?.JiraTickets}
/>
<SettingsSelector
label="Slack Messages"
value={formState.SlackMessages}
defaultValue={formState?.SlackMessages}
/>
<SettingsSelector
label="GitHub PRs"
value={formState.GitHubPRs}
defaultValue={formState?.GitHubPRs}
/>
<SettingsSelector
label="Notion Pages"
value={formState.NotionPages}
defaultValue={formState?.NotionPages}
/>
<SettingsSelector
label="Linear Tickets"
value={formState.LinearTickets}
defaultValue={formState?.LinearTickets}
/>
<SettingsSelector
label="Confluence Docs"
value={formState.ConfluenceDocs}
defaultValue={formState?.ConfluenceDocs}
/>

<div className="">
<span>AI Summary: </span>
Expand All @@ -103,12 +83,12 @@ async function Settings({}) {
defaultValue={formState?.AISummary}
value={formState.AISummary}
>
<option value={1}>Active</option>;
<option value={0}>Inactive</option>;
<option value={1}>Active</option>
<option value={0}>Inactive</option>
</select>
</div>
<button className="btn btn-primary" type="button" disabled={true}>
"Save"
<button className="btn btn-primary" type="button" disabled={false}>
{"Save"}
</button>
</form>
</div>
Expand Down
Loading
Loading