mirror of
https://github.com/arthyn/sphinx.git
synced 2024-12-26 01:12:36 +03:00
posts: fixing logic and cleaning up debugger/console.logs
This commit is contained in:
parent
aac4333e0a
commit
1607b4e307
@ -14,7 +14,6 @@ interface ListingsProps {
|
|||||||
|
|
||||||
export const Listings = ({ listings, remove, className }: ListingsProps) => {
|
export const Listings = ({ listings, remove, className }: ListingsProps) => {
|
||||||
const { installed, outgoing, remove: removePal } = usePals();
|
const { installed, outgoing, remove: removePal } = usePals();
|
||||||
console.log(outgoing);
|
|
||||||
if (!listings) {
|
if (!listings) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -68,10 +68,6 @@ export const TagField = ({ tags, onTags, className }: TagFieldProps) => {
|
|||||||
value: OnChangeValue<Option, true>,
|
value: OnChangeValue<Option, true>,
|
||||||
actionMeta: ActionMeta<Option>
|
actionMeta: ActionMeta<Option>
|
||||||
) => {
|
) => {
|
||||||
console.group('Value Changed');
|
|
||||||
console.log(value);
|
|
||||||
console.log(`action: ${actionMeta.action}`);
|
|
||||||
console.groupEnd();
|
|
||||||
onTags(value);
|
onTags(value);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@ -85,10 +81,6 @@ export const TagField = ({ tags, onTags, className }: TagFieldProps) => {
|
|||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case 'Enter':
|
case 'Enter':
|
||||||
case 'Tab':
|
case 'Tab':
|
||||||
console.group('Value Added');
|
|
||||||
console.log(tags);
|
|
||||||
console.groupEnd();
|
|
||||||
|
|
||||||
setInput('');
|
setInput('');
|
||||||
onTags([...tags, createOption(input)])
|
onTags([...tags, createOption(input)])
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -39,7 +39,6 @@ export const Post = () => {
|
|||||||
const type = watch('type');
|
const type = watch('type');
|
||||||
|
|
||||||
const onSubmit = useCallback((values: Omit<PostForm, 'tags'>) => {
|
const onSubmit = useCallback((values: Omit<PostForm, 'tags'>) => {
|
||||||
debugger;
|
|
||||||
api.poke<Declare>({
|
api.poke<Declare>({
|
||||||
app: 'sphinx',
|
app: 'sphinx',
|
||||||
mark: 'declare',
|
mark: 'declare',
|
||||||
|
@ -32,7 +32,6 @@ export const useNotebooks = () => {
|
|||||||
const { data, isLoading: metadataLoading } = useQuery('metadata', () => api.subscribeOnce<MetaDataUpdate>('metadata-store', '/all'));
|
const { data, isLoading: metadataLoading } = useQuery('metadata', () => api.subscribeOnce<MetaDataUpdate>('metadata-store', '/all'));
|
||||||
const { groups, loading } = usePublicGroups(data || {} as MetaDataUpdate);
|
const { groups, loading } = usePublicGroups(data || {} as MetaDataUpdate);
|
||||||
|
|
||||||
console.log(keys);
|
|
||||||
const notebooks: Record<string, Association<MetadataConfig>> = _.fromPairs(!data || loading ? [] : Object.entries(data['metadata-update'].associations)
|
const notebooks: Record<string, Association<MetadataConfig>> = _.fromPairs(!data || loading ? [] : Object.entries(data['metadata-update'].associations)
|
||||||
.filter(([,v]) => v['app-name'] === 'graph'
|
.filter(([,v]) => v['app-name'] === 'graph'
|
||||||
&& 'graph' in v.metadata.config
|
&& 'graph' in v.metadata.config
|
||||||
@ -41,8 +40,6 @@ export const useNotebooks = () => {
|
|||||||
&& groups.find(([, gv]) => gv.group === v.group)
|
&& groups.find(([, gv]) => gv.group === v.group)
|
||||||
).map(([,v]) => [v.resource.replace('/ship/', ''), v]));
|
).map(([,v]) => [v.resource.replace('/ship/', ''), v]));
|
||||||
|
|
||||||
console.log(data)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
loading: metadataLoading || loading,
|
loading: metadataLoading || loading,
|
||||||
notebooks,
|
notebooks,
|
||||||
@ -85,7 +82,7 @@ export const usePosts = (ship: string, name: string, type: PostType, tags: strin
|
|||||||
}}
|
}}
|
||||||
}) : [];
|
}) : [];
|
||||||
|
|
||||||
const posts = items.filter(p => !d || d.listings.length === 0 || d.listings.find(l => l.post.link === p.post.link));
|
const posts = items.filter(p => !d || d.listings.length === 0 || !d.listings.find(l => l.post.link === p.post.link));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
notebook: association,
|
notebook: association,
|
||||||
@ -130,7 +127,6 @@ export function getSnippet(body: Content[]): { image: string, content: string }
|
|||||||
|
|
||||||
let sum = 0;
|
let sum = 0;
|
||||||
const firstContent = body.reduce((text, c) => {
|
const firstContent = body.reduce((text, c) => {
|
||||||
debugger;
|
|
||||||
if ('text' in c && sum < 255) {
|
if ('text' in c && sum < 255) {
|
||||||
sum += removeMd(c.text).length;
|
sum += removeMd(c.text).length;
|
||||||
return text + c.text + ' ';
|
return text + c.text + ' ';
|
||||||
@ -143,9 +139,6 @@ export function getSnippet(body: Content[]): { image: string, content: string }
|
|||||||
const end = content.length > 256 ? 255 : content.length;
|
const end = content.length > 256 ? 255 : content.length;
|
||||||
const start = content.substring(0, end);
|
const start = content.substring(0, end);
|
||||||
|
|
||||||
if (firstContent.match(/jiddu/i)) {
|
|
||||||
debugger;
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
content: start === firstContent ? start : `${start}...`,
|
content: start === firstContent ? start : `${start}...`,
|
||||||
image: getImage(firstContent) || image
|
image: getImage(firstContent) || image
|
||||||
|
Loading…
Reference in New Issue
Block a user