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

Profile page #124

Merged
merged 18 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
25 changes: 13 additions & 12 deletions apps/builddao/widget/Profile.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
if (!context.accountId || !props.accountId) {
if (!(props.accountId ?? context.accountId)) {
return "No Account ID";
}

const accountId = props.accountId || context.accountId;
const accountId = props.accountId ?? context.accountId;

const profile = Social.getr(`${accountId}/profile`);
if (!profile) {
Expand All @@ -13,6 +13,11 @@ const ProfileContainer = styled.div`
display: grid;
grid-template-columns: repeat(6, minmax(0, 1fr));
gap: 1rem;

@media screen and (max-width: 768px) {
display: flex;
flex-direction: column;
}
`;

const SideContainer = styled.div`
Expand All @@ -32,17 +37,13 @@ return (
/>
</SideContainer>
<MainContainer>
<button
onClick={() => {
Social.set({
profile: {
location: "Multan, Pakistan",
},
});
<Widget
src="buildhub.near/widget/components.profile.ProfileTabs"
props={{
accountId,
profile,
}}
>
test
</button>
/>
</MainContainer>
</ProfileContainer>
);
12 changes: 7 additions & 5 deletions apps/builddao/widget/components/InputField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ const Label = styled.label`

const Input = styled.input`
display: flex;
max-width: ${(props) => props.maxWidth ?? "390px"};
width: 100%;
padding: 16px 12px;
padding: 12px;
align-items: flex-start;
gap: 10px;

Expand Down Expand Up @@ -48,15 +47,18 @@ function InputField({
maxWidth,
}) {
return (
<InputContainer>
<InputContainer
key={`input-container-${key}`}
style={{ maxWidth: maxWidth ?? "390px" }}
>
{label && <Label>{label}</Label>}
<Input
key={key}
key={`input-field-${key}`}
value={value}
onChange={onChange}
placeholder={placeholder}
type={type ?? "text"}
maxWidth={maxWidth}
style={{ maxWidth: maxWidth ?? "390px" }}
/>
</InputContainer>
);
Expand Down
5 changes: 4 additions & 1 deletion apps/builddao/widget/components/Post.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,10 @@ const contentWidget = (

return (
<>
<StyledPost key={`Post-${item.path}-${item.blockHeight}`}>
<StyledPost
key={`Post-${item.path}-${item.blockHeight}`}
style={{ width: props.width ? props.width : "auto" }}
>
<Wrapper
className="w-100 mx-auto"
style={
Expand Down
49 changes: 34 additions & 15 deletions apps/builddao/widget/components/TextEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,41 @@ const MarkdownEditor = `
}
`;

function TextEditor({ value, onChange, maxWidth }) {
const Label = styled.label`
color: var(--label-color, #fff);

/* Body/16px */
font-size: 16px;
font-style: normal;
font-weight: 400;
line-height: 170%; /* 27.2px */
`;

const Container = styled.div`
display: flex;
flex-direction: column;
gap: 4px;
`;

function TextEditor({ value, label, onChange, maxWidth }) {
return (
<TextareaWrapper
className="markdown-editor"
data-value={value || ""}
style={{ maxWidth: maxWidth ? maxWidth : "550px" }}
>
<Widget
src="mob.near/widget/MarkdownEditorIframe"
props={{
initialText: value,
embedCss: props.EditorCSS || MarkdownEditor,
onChange,
}}
/>
</TextareaWrapper>
<Container>
<Label>{label}</Label>
<TextareaWrapper
className="markdown-editor"
data-value={value || ""}
style={{ maxWidth: maxWidth ? maxWidth : "550px" }}
>
<Widget
src="mob.near/widget/MarkdownEditorIframe"
props={{
initialText: value,
embedCss: props.EditorCSS || MarkdownEditor,
onChange,
}}
/>
</TextareaWrapper>
</Container>
);
}

Expand Down
3 changes: 2 additions & 1 deletion apps/builddao/widget/components/User.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ const Overlay = (props) => (
<Link
className="link-dark text-truncate d-inline-flex mw-100"
to={href({
widgetSrc: "mob.near/widget/ProfilePage",
widgetSrc: "mob.near/widget/app",
itexpert120 marked this conversation as resolved.
Show resolved Hide resolved
params: {
page: "profile",
accountId,
},
})}
Expand Down
2 changes: 1 addition & 1 deletion apps/builddao/widget/components/buttons/UserDropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ return (
<Link
className="dropdown-item"
type="button"
to={`/mob.near/widget/ProfilePage?accountId=${context.accountId}`}
to={`/buildhub.near/widget/app?page=profile&accountId=${context.accountId}`}
itexpert120 marked this conversation as resolved.
Show resolved Hide resolved
>
<User />
My Profile
Expand Down
6 changes: 1 addition & 5 deletions apps/builddao/widget/components/navigation/header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,7 @@ const AppHeader = ({ page, routes, ...props }) => (
}
return (
<NavLink to={k}>
<Button
key={k}
variant={page === k && "primary"}
style={{ padding: "0.5rem 1rem", fontWeight: 500 }}
>
<Button key={k} variant={page === k && "primary"}>
{route.init.icon && <i className={route.init.icon}></i>}
{route.init.name}
</Button>
Expand Down
5 changes: 3 additions & 2 deletions apps/builddao/widget/components/post/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ const Overlay = (props) => (
<Link
className="link-dark text-truncate d-inline-flex mw-100"
to={href({
widgetSrc: "mob.near/widget/ProfilePage",
widgetSrc: "buildhub.near/widget/app",
params: {
page: "profile",
accountId,
},
})}
Expand Down Expand Up @@ -155,7 +156,7 @@ return (
)}
</Wrapper>
{pinned && (
<span title="Pinned" className="ms-2">
<span title="Pinned" className="ms-2 text-white">
<i className="bi bi-pin-angle" />
</span>
)}
Expand Down
Loading