Skip to content

Commit

Permalink
Merge pull request #29 from NEARBuilders/fix-flashes
Browse files Browse the repository at this point in the history
Fix flashes in UI
  • Loading branch information
elliotBraem authored Jan 9, 2024
2 parents 9226d18 + f923056 commit 04b97b3
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 31 deletions.
2 changes: 1 addition & 1 deletion apps/builddao/widget/Aside.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const AsideContainer = styled.div`
`;

const { Button } =
VM.require("buildhub.near/widget/components.Button") || (() => {});
VM.require("buildhub.near/widget/components.Button") || (() => <></>);

const { routes, active, setActiveRoute } = props;

Expand Down
3 changes: 3 additions & 0 deletions apps/builddao/widget/Compose.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const { Avatar, Button } = VM.require("buildhub.near/widget/components");

Avatar = Avatar || (() => <></>);
Button = Button || (() => <></>);

const draftKey = props.feed.name || "draft";
const draft = Storage.privateGet(draftKey);

Expand Down
3 changes: 2 additions & 1 deletion apps/builddao/widget/Resources.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { MarkdownView } = VM.require("buildhub.near/widget/md-view");
const { MarkdownView } =
VM.require("buildhub.near/widget/md-view") || (() => <></>);

const Container = styled.div`
display: grid;
Expand Down
13 changes: 13 additions & 0 deletions apps/builddao/widget/components/Library.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ const {
Checkbox,
} = VM.require("buildhub.near/widget/components");

Button = Button || (() => <></>);
Pagination = Pagination || (() => <></>);
ProgressState = ProgressState || (() => <></>);
Step = Step || (() => <></>);
Post = Post || (() => <></>);
InputField = InputField || (() => <></>);
UploadField = UploadField || (() => <></>);
TextBox = TextBox || (() => <></>);
TextEditor = TextEditor || (() => <></>);
User = User || (() => <></>);
Avatar = Avatar || (() => <></>);
Checkbox = Checkbox || (() => <></>);

// states
const [checked, setChecked] = useState(false);

Expand Down
4 changes: 3 additions & 1 deletion apps/builddao/widget/components/Post.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { User, BookmarkButton } = VM.require("buildhub.near/widget/components");
const { User } = VM.require("buildhub.near/widget/components");

User = User || (() => <></>);

const StyledPost = styled.div`
margin-bottom: 1rem;
Expand Down
47 changes: 24 additions & 23 deletions apps/builddao/widget/components/Step.jsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
const { ProgressState } = VM.require("buildhub.near/widget/components.ProgressState");
const { ProgressState } =
VM.require("buildhub.near/widget/components.ProgressState") || (() => <></>);

const StepContainer = styled.div`
position: relative;
position: relative;
&::before {
content: "";
position: absolute;
top: 50%;
left: 0;
right: 0;
height: 1px;
background: #000; /* Change color as needed */
background-image: repeating-linear-gradient(
90deg,
#3c3d43,
#3c3d43 2px,
transparent 2px,
transparent 4px
);
transform: translateY(-50%);
z-index: -1;
}
`;

&::before {
content: "";
position: absolute;
top: 50%;
left: 0;
right: 0;
height: 1px;
background: #000; /* Change color as needed */
background-image: repeating-linear-gradient(
90deg,
#3c3d43,
#3c3d43 2px,
transparent 2px,
transparent 4px
);
transform: translateY(-50%);
z-index: -1;
}
`;

function Step(props) {
const totalSteps = props.totalSteps ?? 5;
const currentStep = props.currentStep ?? 3;
Expand Down Expand Up @@ -52,4 +53,4 @@ function Step(props) {
);
}

return { Step };
return { Step };
5 changes: 3 additions & 2 deletions apps/builddao/widget/components/UploadField.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { Button } = VM.require("buildhub.near/widget/components.Button");
const { Button } =
VM.require("buildhub.near/widget/components.Button") || (() => <></>);

const UploadContainer = styled.div`
display: flex;
Expand Down Expand Up @@ -60,4 +61,4 @@ function UploadField({ background }) {
);
}

return { UploadField };
return { UploadField };
3 changes: 2 additions & 1 deletion apps/builddao/widget/components/User.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { Avatar } = VM.require("buildhub.near/widget/components");
const { Avatar } =
VM.require("buildhub.near/widget/components") || (() => <></>);

const Button = styled.div`
line-height: 20px;
Expand Down
3 changes: 2 additions & 1 deletion apps/builddao/widget/resources-aside.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { Button } = VM.require("buildhub.near/widget/components");
const { Button } =
VM.require("buildhub.near/widget/components") || (() => <></>);

const Container = styled.div`
border-radius: 16px;
Expand Down
2 changes: 1 addition & 1 deletion apps/embeds/widget/Feed.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { Feed } = VM.require("devs.near/widget/Module.Feed");
const { Feed } = VM.require("devs.near/widget/Module.Feed") || (() => <></>);

Feed = Feed || (() => <></>); // make sure you have this or else it can break

Expand Down

0 comments on commit 04b97b3

Please sign in to comment.