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

Store solution post parameters as separate fields apart from description #288

Merged
merged 108 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
5e5fd99
chore: Format
carina-akaia Jul 20, 2023
0803e08
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Aug 1, 2023
6b5d095
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Aug 7, 2023
7a82065
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Aug 9, 2023
a0f340f
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Aug 11, 2023
d7a2a1b
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Aug 24, 2023
8a52596
wip: Assign alias for gh ticket author
carina-akaia Sep 2, 2023
fb7f141
wip
carina-akaia Sep 4, 2023
fb0d093
wip
carina-akaia Sep 5, 2023
a9ed58e
wip
carina-akaia Sep 6, 2023
a0ea45f
wip
carina-akaia Sep 6, 2023
f82a4aa
wip
carina-akaia Sep 6, 2023
ffe44c8
wip
carina-akaia Sep 8, 2023
48dae96
wip
carina-akaia Sep 8, 2023
67c7386
wip: Make it work
carina-akaia Sep 10, 2023
777be97
wip
carina-akaia Sep 10, 2023
3b51ed6
wip
carina-akaia Sep 10, 2023
b704b24
wip
carina-akaia Sep 11, 2023
11fa55d
fix: Determine if view is initialized properly
carina-akaia Sep 12, 2023
2597826
wip
carina-akaia Sep 12, 2023
c66c7c1
wip
carina-akaia Sep 14, 2023
65e44bd
wip
carina-akaia Sep 14, 2023
0640148
wip
carina-akaia Sep 14, 2023
3716aa4
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Sep 14, 2023
5289548
wip
carina-akaia Sep 14, 2023
b6f74d9
wip
carina-akaia Sep 14, 2023
968253f
fix: Disable border
carina-akaia Sep 14, 2023
64f4445
wip
carina-akaia Sep 15, 2023
d4df7fd
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Sep 15, 2023
be004f6
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Sep 15, 2023
ca31ce9
wip
carina-akaia Sep 15, 2023
6d4989c
wip
carina-akaia Sep 15, 2023
3d48517
wip
carina-akaia Sep 15, 2023
4eeffeb
Adjust wording
carina-akaia Sep 15, 2023
2f745bf
Adjust wording
carina-akaia Sep 15, 2023
6f6a822
Adjust wording
carina-akaia Sep 15, 2023
aec9980
Enable all features
carina-akaia Sep 15, 2023
0a4fb1a
fix: Adjust viewport width
carina-akaia Sep 18, 2023
2c0e8b5
Implement pre-release amendments
carina-akaia Sep 25, 2023
583ea3b
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Sep 25, 2023
89f54ca
wip
carina-akaia Sep 25, 2023
8408fd6
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Sep 29, 2023
30be4a7
fix: Derive sponsorship request indicator
carina-akaia Sep 29, 2023
af59c5a
Introduce updated solution post format
carina-akaia Sep 30, 2023
1b1ca6e
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Oct 3, 2023
b2e6ded
wip: Unlock noop controls
carina-akaia Oct 3, 2023
c093506
wip
carina-akaia Oct 6, 2023
a858cbb
wip
carina-akaia Oct 6, 2023
5803ff0
wip
carina-akaia Oct 6, 2023
019f31c
wip
carina-akaia Oct 8, 2023
2b41320
wip
carina-akaia Oct 8, 2023
3e6c6d3
wip
carina-akaia Oct 8, 2023
726c509
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Oct 8, 2023
8bbb8e5
wip
carina-akaia Oct 10, 2023
e6d49b6
wip: Fix errors preventing post spawner rendering
carina-akaia Oct 10, 2023
c0bb50a
wip
carina-akaia Oct 10, 2023
840bc01
wip
carina-akaia Oct 10, 2023
befec56
wip
carina-akaia Oct 10, 2023
0a79007
feat: Added USDC currency support for solution and sponsorship posts …
espensimensen Oct 11, 2023
28b1d91
fix: Fixed existing currency value not being set on edit (#263)
espensimensen Oct 11, 2023
d5fe82a
wip: Create new post compose page
carina-akaia Oct 12, 2023
c598797
wip
carina-akaia Oct 12, 2023
6156d47
Merge branch 'main' into feature/usdc-support
espensimensen Oct 12, 2023
9836d0e
fix: Use SimpleMDE on testnet
carina-akaia Oct 13, 2023
51e859a
wip
carina-akaia Oct 13, 2023
66b87b2
wip: Prepare branch for release
carina-akaia Oct 13, 2023
2a8c229
wip: Prepare branch for release
carina-akaia Oct 13, 2023
1080072
Merge branch 'feature/usdc-support' of https://github.com/espensimens…
carina-akaia Oct 13, 2023
6ce0739
wip: Prepare branch for release
carina-akaia Oct 13, 2023
1f09cce
wip: Disable unimplemented feature
carina-akaia Oct 13, 2023
6dc15b5
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Oct 13, 2023
71d69df
chore: Format
carina-akaia Oct 13, 2023
ff072f3
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Oct 16, 2023
fa1d1aa
chore: Format
carina-akaia Oct 18, 2023
73b2044
wip
carina-akaia Oct 18, 2023
45d80a1
wip
carina-akaia Oct 18, 2023
fe7ab6f
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Oct 18, 2023
f76d7b4
wip: Rollback post history component to main
carina-akaia Oct 18, 2023
8c51f58
wip: Fix typo
carina-akaia Oct 18, 2023
6a1792f
wip
carina-akaia Oct 18, 2023
1000607
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Oct 18, 2023
47509e8
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Oct 19, 2023
674c348
wip
carina-akaia Oct 19, 2023
858d0b6
wip: Detect if there's a relevant draft
carina-akaia Oct 23, 2023
094cb35
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Oct 24, 2023
a410172
chore: Format
carina-akaia Oct 24, 2023
9bfd565
fix: Use correct component ids
carina-akaia Oct 24, 2023
0e5a305
fix: Display community activity via post lookup component
carina-akaia Oct 24, 2023
49496e7
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Oct 24, 2023
4a06cf8
fix: Preserve default behavior for `npm run dev`
carina-akaia Oct 24, 2023
3c53646
chore: Format
carina-akaia Oct 24, 2023
2ef4c29
Merge branch 'hotfix/24102023-npm-dev' of https://github.com/near-aka…
carina-akaia Oct 24, 2023
6a6cf53
fix: Use correct component id
carina-akaia Oct 24, 2023
5fc7375
chore: Format
carina-akaia Oct 24, 2023
3740e47
fix: Make community activity feed a little bit less broken
carina-akaia Oct 24, 2023
616f73e
fix: Use correct component id
carina-akaia Oct 24, 2023
4d9bc68
wip: Fix tags propagation
carina-akaia Oct 24, 2023
70bc841
fix: Reincarnate post draft recovery
carina-akaia Oct 24, 2023
af739d1
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Oct 26, 2023
8f6438f
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Oct 31, 2023
eb6272a
wip: Apply post-review amendments
carina-akaia Oct 31, 2023
4e13a15
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Oct 31, 2023
087cd22
chore: Format
carina-akaia Oct 31, 2023
7cefb1a
fix: Rollback irrelevant changes
carina-akaia Nov 1, 2023
4751e33
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Nov 1, 2023
0efa0b6
Apply post-review amendments
carina-akaia Nov 1, 2023
2926371
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Nov 1, 2023
a5ee63c
fix: Delete redundant code
carina-akaia Nov 1, 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
13 changes: 11 additions & 2 deletions module/core/lib/autocomplete.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const autocompleteEnabled = true;

const AutoComplete = styled.div`
z-index: 5;

Expand All @@ -9,11 +10,19 @@ const AutoComplete = styled.div`

function textareaInputHandler(value) {
const showAccountAutocomplete = /@[\w][^\s]*$/.test(value);
State.update({ text: value, showAccountAutocomplete });
State.update((lastKnownState) => ({
...lastKnownState,
text: value,
showAccountAutocomplete,
}));
}

function autoCompleteAccountId(id) {
let description = state.description.replace(/[\s]{0,1}@[^\s]*$/, "");
description = `${description} @${id}`.trim() + " ";
State.update({ description, showAccountAutocomplete: false });
State.update((lastKnownState) => ({
...lastKnownState,
description,
showAccountAutocomplete: false,
}));
}
55 changes: 30 additions & 25 deletions src/devhub/components/organism/Configurator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ const defaultFieldUpdate = ({
}
};

const useForm = ({ initialValues, onUpdate, stateKey }) => {
const useForm = ({ initialValues, onUpdate, stateKey, uninitialized }) => {
const initialFormState = {
hasUnsubmittedChanges: false,
values: initialValues ?? {},
};

const formState = state[stateKey] ?? null;
const formState = state[stateKey] ?? null,
isSynced = Struct.isEqual(formState?.values ?? {}, initialFormState.values);

const formReset = () =>
State.update((lastKnownComponentState) => ({
Expand All @@ -60,48 +61,52 @@ const useForm = ({ initialValues, onUpdate, stateKey }) => {
const formUpdate =
({ path, via: customFieldUpdate, ...params }) =>
(fieldInput) => {
const transformFn = (node) => {
if (typeof customFieldUpdate === "function") {
return customFieldUpdate({
input: fieldInput?.target?.value ?? fieldInput,
lastKnownValue: node,
params,
});
} else {
return defaultFieldUpdate({
input: fieldInput?.target?.value ?? fieldInput,
lastKnownValue: node,
params,
});
}
};
const updatedValues = Struct.deepFieldUpdate(
formState?.values ?? {},
path,
(node) => transformFn(node)

{
input: fieldInput?.target?.value ?? fieldInput,
params,
path,

via:
typeof customFieldUpdate === "function"
? customFieldUpdate
: defaultFieldUpdate,
}
);

State.update((lastKnownComponentState) => ({
...lastKnownComponentState,

[stateKey]: {
hasUnsubmittedChanges: !Struct.isEqual(
updatedValues,
initialFormState.values
),

values: updatedValues,
},
}));

if (typeof onUpdate === "function") {
if (
typeof onUpdate === "function" &&
!Struct.isEqual(updatedValues, initialFormState.values)
) {
onUpdate(updatedValues);
}
};

if (
!uninitialized &&
(formState === null || (!formState.hasUnsubmittedChanges && !isSynced))
) {
formReset();
}

return {
hasUnsubmittedChanges: formState?.hasUnsubmittedChanges ?? false,
values: {
...(initialValues ?? {}),
...(formState?.values ?? {}),
},
...(formState ?? initialFormState),
isSynced,
reset: formReset,
stateKey,
update: formUpdate,
Expand Down
13 changes: 11 additions & 2 deletions src/devhub/entity/post/PostEditor.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* INCLUDE: "core/lib/autocomplete" */
const autocompleteEnabled = true;

const AutoComplete = styled.div`
z-index: 5;

Expand All @@ -10,13 +11,21 @@ const AutoComplete = styled.div`

function textareaInputHandler(value) {
const showAccountAutocomplete = /@[\w][^\s]*$/.test(value);
State.update({ text: value, showAccountAutocomplete });
State.update((lastKnownState) => ({
...lastKnownState,
text: value,
showAccountAutocomplete,
}));
}

function autoCompleteAccountId(id) {
let description = state.description.replace(/[\s]{0,1}@[^\s]*$/, "");
description = `${description} @${id}`.trim() + " ";
State.update({ description, showAccountAutocomplete: false });
State.update((lastKnownState) => ({
...lastKnownState,
description,
showAccountAutocomplete: false,
}));
}
/* END_INCLUDE: "core/lib/autocomplete" */

Expand Down
13 changes: 11 additions & 2 deletions src/devhub/page/create.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ if (!href) {

/* INCLUDE: "core/lib/autocomplete" */
const autocompleteEnabled = true;

const AutoComplete = styled.div`
z-index: 5;

Expand All @@ -16,13 +17,21 @@ const AutoComplete = styled.div`

function textareaInputHandler(value) {
const showAccountAutocomplete = /@[\w][^\s]*$/.test(value);
State.update({ text: value, showAccountAutocomplete });
State.update((lastKnownState) => ({
...lastKnownState,
text: value,
showAccountAutocomplete,
}));
}

function autoCompleteAccountId(id) {
let description = state.description.replace(/[\s]{0,1}@[^\s]*$/, "");
description = `${description} @${id}`.trim() + " ";
State.update({ description, showAccountAutocomplete: false });
State.update((lastKnownState) => ({
...lastKnownState,
description,
showAccountAutocomplete: false,
}));
}
/* END_INCLUDE: "core/lib/autocomplete" */

Expand Down
Loading