-
- {key}
-
+ {key}
|
@@ -175,96 +170,93 @@ const renderMenuItem = (c, i) => {
};
const Wrapper = styled.div`
-@media(min-width: 992px) {
- .b-s {
- border-left: 1px solid #eee;
- }
- .b-e {
- border-right: 1px solid #eee;
+ @media (min-width: 992px) {
+ .b-s {
+ border-left: 1px solid #eee;
+ }
+ .b-e {
+ border-right: 1px solid #eee;
+ }
}
-}
-.category:not(:first-child) {
- margin-top: 1em;
-}
-.component {
- padding: 0.5em 12px;
- padding-bottom: 0;
- margin-bottom: 3em;
- margin: 0 -12px 3em;
- position: relative;
-
- &:hover {
- background: rgba(0, 0, 0, 0.03);
+ .category:not(:first-child) {
+ margin-top: 1em;
}
+ .component {
+ padding: 0.5em 12px;
+ padding-bottom: 0;
+ margin-bottom: 3em;
+ margin: 0 -12px 3em;
+ position: relative;
- .anchor {
- position: absolute;
- top: -70px;
- }
+ &:hover {
+ background: rgba(0, 0, 0, 0.03);
+ }
- table {
- background: white;
- }
+ .anchor {
+ position: absolute;
+ top: -70px;
+ }
- label {
- font-size: 20px;
- }
+ table {
+ background: white;
+ }
- .code {
- display: inline-flex;
- line-height: normal;
- border-radius: 0.3em;
- padding: 0 4px;
- border: 1px solid #ddd;
- background: rgba(0, 0, 0, 0.03);
- font-family: var(--bs-font-monospace);
- }
- .path {
+ label {
+ font-size: 20px;
+ }
- }
- .preview {
- background-color: white;
- padding: 12px;
- border: 1px solid #eee;
- border-radius: 12px;
- pre {
- margin-bottom: 0;
+ .code {
+ display: inline-flex;
+ line-height: normal;
+ border-radius: 0.3em;
+ padding: 0 4px;
+ border: 1px solid #ddd;
+ background: rgba(0, 0, 0, 0.03);
+ font-family: var(--bs-font-monospace);
}
- }
- .props {
- .prop-key {
- font-weight: 600;
- &.optional {
- font-weight: normal;
- }
+ .path {
}
- .prop-desc {
- p {
+ .preview {
+ background-color: white;
+ padding: 12px;
+ border: 1px solid #eee;
+ border-radius: 12px;
+ pre {
margin-bottom: 0;
}
}
- }
- .embed-code {
- position: relative;
+ .props {
+ .prop-key {
+ font-weight: 600;
+ &.optional {
+ font-weight: normal;
+ }
+ }
+ .prop-desc {
+ p {
+ margin-bottom: 0;
+ }
+ }
+ }
+ .embed-code {
+ position: relative;
- .embed-copy {
- position: absolute;
- top: 18px;
- right: 10px;
+ .embed-copy {
+ position: absolute;
+ top: 18px;
+ right: 10px;
+ }
}
}
-}
`;
return (
Social Components Library
-
- This library contains common social components used by near.social
-
+ This library contains common social components used by near.social
{components.map(renderMenuItem)}
{components.map(renderComponent)}
-);
\ No newline at end of file
+);
diff --git a/widget/markdown/view.jsx b/widget/MarkdownViewer.jsx
similarity index 88%
rename from widget/markdown/view.jsx
rename to widget/MarkdownViewer.jsx
index d7cdb8e..2d78fa0 100644
--- a/widget/markdown/view.jsx
+++ b/widget/MarkdownViewer.jsx
@@ -38,11 +38,7 @@ function MarkdownViewer(props) {
const renderMention =
props.renderMention ??
((accountId) => (
-
+
0
- ? state.linktree
- : undefined,
- image:
- options.image && state.image && Object.keys(state.image).length > 0
- ? state.image
- : undefined,
- backgroundImage:
- options.backgroundImage &&
- state.backgroundImage &&
- Object.keys(state.backgroundImage).length > 0
- ? state.backgroundImage
- : undefined,
- tags: options.tags ? state.metadata.tags : undefined,
- screenshots: options.screenshots ? state.metadata.screenshots : undefined,
-};
-
-if (
- onChange &&
- JSON.stringify(state.reportedMetadata) !== JSON.stringify(metadata)
-) {
- State.update({
- reportedMetadata: metadata,
- });
- onChange(metadata);
-}
-
-return (
- <>
- {options.name && (
-
- {options.name.label ?? "Name"}
-
-
- )}
- {options.image && (
-
- {options.image.label ?? "Image"}
- State.update({ image }),
- }}
- />
-
- )}
- {options.backgroundImage && (
-
- {options.backgroundImage.label ?? "Background image"}
- State.update({ backgroundImage }),
- }}
- />
-
- )}
- {options.description && (
-
- {options.description.label ?? "Description"}
- (supports markdown)
-
- )}
- {options.tags && (
-
-
- {options.tags.label ?? "Give Context with Tags:"}
-
- {
- state.metadata.tags = tags;
- State.update();
- },
- }}
- />
-
- )}
- {options.linktree &&
- (options.linktree.links ?? []).map((link) => (
-
- {link.label}
-
- {link.prefix}
-
-
-
- ))}
- >
-);
diff --git a/widget/Modal.jsx b/widget/Modal.jsx
index 9056878..8c53f87 100644
--- a/widget/Modal.jsx
+++ b/widget/Modal.jsx
@@ -1,12 +1,4 @@
-const {
- Trigger,
- Content,
- isOpen,
- onClose,
- onOpen,
- ModalOverlay,
- ModalContainer,
-} = props ?? {
+const { Trigger, Content, isOpen, onClose, onOpen, ModalOverlay, ModalContainer } = props ?? {
Trigger: () => <>>,
Content: () => <>>,
isOpen: false,
@@ -59,9 +51,7 @@ const Modal = ({ isOpen, closeModal, children }) => {
return (
- e.stopPropagation()}>
- {children}
-
+ e.stopPropagation()}>{children}
);
};
diff --git a/widget/MonacoEditor.jsx b/widget/MonacoEditor.jsx
index 4d8ddf8..991d8a7 100644
--- a/widget/MonacoEditor.jsx
+++ b/widget/MonacoEditor.jsx
@@ -12,11 +12,6 @@ const Container = styled.div`
return (
-
+
);
diff --git a/widget/Notification/Item.jsx b/widget/Notification/Item.jsx
deleted file mode 100644
index 2a44450..0000000
--- a/widget/Notification/Item.jsx
+++ /dev/null
@@ -1,41 +0,0 @@
-const { value } = props;
-
-const loading = ;
-
-const widgetSrc =
- value.type === "follow" || value.type === "unfollow"
- ? "${alias_mob}/widget/Notification.Item.Follow"
- : value.type === "poke"
- ? "${alias_mob}/widget/Notification.Item.Poke"
- : value.type === "like"
- ? "${alias_mob}/widget/Notification.Item.Like"
- : value.type === "comment"
- ? "${alias_mob}/widget/Notification.Item.Comment"
- : value.type && value.type?.startsWith("devgovgigs/")
- ? "${alias_mob}/widget/Notification.Item.DevGov"
- : value.type === "mention"
- ? "${alias_mob}/widget/Notification.Item.Mention"
- : value.type === "repost"
- ? "${alias_mob}/widget/Notification.Item.Repost"
- : value.type === "chess-game"
- ? "chess-game.near/widget/Notification.Item.ChessGame@98857466"
- : value.type === "request"
- ? "hack.near/widget/Notification.Item.Request"
- : null;
-
-return (
-
- {widgetSrc ? (
-
- ) : (
-
- Unknown notification:{" "}
- {JSON.stringify(value)}
-
- )}
-
-);
diff --git a/widget/PR/FilteredIndexFeed.jsx b/widget/PR/FilteredIndexFeed.jsx
index 77b4152..ef72eb2 100644
--- a/widget/PR/FilteredIndexFeed.jsx
+++ b/widget/PR/FilteredIndexFeed.jsx
@@ -8,4 +8,4 @@ return (
src="${config_account}/widget/PR.IndexFeed"
props={{ filter, ...props }}
/>
-);
\ No newline at end of file
+);
diff --git a/widget/PR/IndexFeed.jsx b/widget/PR/IndexFeed.jsx
index 651bc88..f4d5084 100644
--- a/widget/PR/IndexFeed.jsx
+++ b/widget/PR/IndexFeed.jsx
@@ -23,8 +23,7 @@ const cachedRenderItem = (item, i) => {
};
index.options = index.options || {};
-const initialRenderLimit =
- props.initialRenderLimit ?? index.options.limit ?? 10;
+const initialRenderLimit = props.initialRenderLimit ?? index.options.limit ?? 10;
const addDisplayCount = props.nextLimit ?? initialRenderLimit;
index.options.limit = Math.min(
@@ -47,9 +46,9 @@ const computeFetchFrom = (items, limit) => {
};
const mergeItems = (newItems) => {
- const items = [
- ...new Set([...newItems, ...state.items].map((i) => JSON.stringify(i))),
- ].map((i) => JSON.parse(i));
+ const items = [...new Set([...newItems, ...state.items].map((i) => JSON.stringify(i)))].map((i) =>
+ JSON.parse(i)
+ );
items.sort((a, b) => a.blockHeight - b.blockHeight);
if (index.options.order === "desc") {
items.reverse();
@@ -103,9 +102,7 @@ if (state.fetchFrom) {
const filteredItems = state.items;
if (filter) {
if (filter.ignore) {
- filteredItems = filteredItems.filter(
- (item) => !(item.accountId in filter.ignore)
- );
+ filteredItems = filteredItems.filter((item) => !(item.accountId in filter.ignore));
}
}
@@ -133,11 +130,7 @@ const makeMoreItems = () => {
const loader = (
-
+
Loading ...
);
@@ -176,11 +169,7 @@ return props.manual ? (
hasMore={state.displayCount < filteredItems.length}
loader={
-
+
Loading ...
}
@@ -189,4 +178,4 @@ return props.manual ? (
{Layout ? {renderedItems} : <>{renderedItems}>}
{props.footerElement}
-);
\ No newline at end of file
+);
diff --git a/widget/PR/MergedIndexFeed.jsx b/widget/PR/MergedIndexFeed.jsx
index a157f8f..e34c564 100644
--- a/widget/PR/MergedIndexFeed.jsx
+++ b/widget/PR/MergedIndexFeed.jsx
@@ -95,22 +95,13 @@ for (let iIndex = 0; iIndex < indices.length; ++iIndex) {
);
const desc = index.options.order === "desc";
- const initialItems = Social.index(
- index.action,
- index.key,
- index.options,
- index.cacheOptions
- );
+ const initialItems = Social.index(index.action, index.key, index.options, index.cacheOptions);
if (initialItems === null) {
continue;
}
const jInitialItems = JSON.stringify(initialItems);
- const nextFetchFrom = computeFetchFrom(
- initialItems,
- index.options.limit,
- desc
- );
+ const nextFetchFrom = computeFetchFrom(initialItems, index.options.limit, desc);
if (feed.jInitialItems !== jInitialItems) {
feed.jInitialItems = jInitialItems;
feedChanged = true;
@@ -181,9 +172,7 @@ while (filteredItems.length < state.displayCount) {
}
if (
bestItem === null ||
- (desc
- ? item.blockHeight > bestItem.blockHeight
- : item.blockHeight < bestItem.blockHeight)
+ (desc ? item.blockHeight > bestItem.blockHeight : item.blockHeight < bestItem.blockHeight)
) {
bestItem = item;
}
@@ -212,9 +201,7 @@ while (filteredItems.length < state.displayCount) {
}
// remove duplicate posts
const existingItemIndex = filteredItems.findIndex(
- (item) =>
- item.blockHeight === bestItem.blockHeight &&
- item.accountId === bestItem.accountId
+ (item) => item.blockHeight === bestItem.blockHeight && item.accountId === bestItem.accountId
);
if (existingItemIndex === -1) {
@@ -276,19 +263,14 @@ const makeMoreItems = () => {
const loader = (
-
+
Loading ...
);
const fetchMore =
props.manual &&
- (state.feeds.some((f) => !!f.fetchFrom) &&
- filteredItems.length < state.displayCount
+ (state.feeds.some((f) => !!f.fetchFrom) && filteredItems.length < state.displayCount
? loader
: state.displayCount < filteredItems.length && (
diff --git a/widget/ProfileEditor.jsx b/widget/ProfileEditor.jsx
deleted file mode 100644
index e5c77a0..0000000
--- a/widget/ProfileEditor.jsx
+++ /dev/null
@@ -1,90 +0,0 @@
-const accountId = context.accountId;
-
-if (!accountId) {
- return "Please sign in with NEAR wallet to edit your profile";
-}
-
-let profile = Social.getr(`${accountId}/profile`);
-
-if (profile === null) {
- return "Loading";
-}
-
-State.init({
- profile,
-});
-
-return (
-
-
-
- Edit profile of @{accountId}
-
-
- State.update({ profile }),
- options: {
- name: { label: "Name" },
- gizmo: { label: "Profile widget" },
- image: { label: "Profile picture" },
- backgroundImage: { label: "Background image" },
- description: { label: "About" },
- tags: {
- label: "Tags",
- tagsPattern: "*/profile/tags/*",
- placeholder:
- "rust, engineer, artist, humanguild, nft, learner, founder",
- },
- linktree: {
- links: [
- {
- label: "Twitter",
- prefix: "https://twitter.com/",
- name: "twitter",
- },
- {
- label: "Github",
- prefix: "https://github.com/",
- name: "github",
- },
- {
- label: "Telegram",
- prefix: "https://t.me/",
- name: "telegram",
- },
- {
- label: "Website",
- prefix: "https://",
- name: "website",
- },
- ],
- },
- },
- }}
- />
-
-
-
-
-
-);
diff --git a/widget/ProfileWidget.jsx b/widget/ProfileWidget.jsx
deleted file mode 100644
index 2140e17..0000000
--- a/widget/ProfileWidget.jsx
+++ /dev/null
@@ -1,18 +0,0 @@
-const accountId = props.accountId ?? context.accountId;
-if (!accountId) {
- return "No account ID";
-}
-
-const profile = props.profile ?? Social.getr(`${accountId}/profile`);
-
-if (profile === null) {
- return "Loading";
-}
-
-const description = profile.description;
-
-State.init({
- loadWidget: false,
-});
-
-return hello ;
diff --git a/widget/Router.jsx b/widget/Router.jsx
index 6a5c610..c148972 100644
--- a/widget/Router.jsx
+++ b/widget/Router.jsx
@@ -31,10 +31,7 @@ function Router({ config, ...passProps }) {
findDefaultRoute(routes) ??
(routes && Object.keys(routes).length && routes[Object.keys(routes)[0]]);
const activeRoute =
- (routes &&
- routes.hasOwnProperty(passProps[param]) &&
- routes[passProps[param]]) ||
- defaultRoute;
+ (routes && routes.hasOwnProperty(passProps[param]) && routes[passProps[param]]) || defaultRoute;
if (!PageNotFound) PageNotFound = () => 404 Not Found ;
diff --git a/widget/Template.jsx b/widget/Template.jsx
index 28df1ce..5077924 100644
--- a/widget/Template.jsx
+++ b/widget/Template.jsx
@@ -13,10 +13,7 @@ const Template = ({ layout, theme, blocks, children }) => {
return (
-
+
{children}
diff --git a/widget/Thing.jsx b/widget/Thing.jsx
index 4e5d355..4df3064 100644
--- a/widget/Thing.jsx
+++ b/widget/Thing.jsx
@@ -1 +1 @@
-const { type, path, blockHeight } = props;
\ No newline at end of file
+const { type, path, blockHeight } = props;
diff --git a/widget/adapter/github.jsx b/widget/adapter/github.jsx
index d2444ee..b68f3cc 100644
--- a/widget/adapter/github.jsx
+++ b/widget/adapter/github.jsx
@@ -2,4 +2,4 @@ function get({ path }) {
return fetch(`https://raw.githubusercontent.com/${path}`);
}
-return { get };
\ No newline at end of file
+return { get };
diff --git a/widget/adapter/openai.jsx b/widget/adapter/openai.jsx
index c8c8115..264ccfa 100644
--- a/widget/adapter/openai.jsx
+++ b/widget/adapter/openai.jsx
@@ -246,10 +246,9 @@ const secretKeyToggle = state.showSecretKey ? (
return (
<>
- NOTE: Each request costs about 0.005 NEAR. Make sure the spending
- account below is funded, and you can also get full access to that account
- by using the secret key. Only you have the key to this account, so don't
- loose it.
+ NOTE: Each request costs about 0.005 NEAR. Make sure the spending account below is
+ funded, and you can also get full access to that account by using the secret key. Only you
+ have the key to this account, so don't loose it.
{iframe}
|