Compare commits

..

7 Commits

Author SHA1 Message Date
Ola Rubaj
92b12455c9 [blog][xs]: rm links from headings 2023-09-25 18:50:55 +02:00
Ola Rubaj
37902bfc71 [blog][m]: jul-aug updates blog post 2023-09-22 19:22:31 +02:00
github-actions[bot]
68fbf2cda6 Version Packages (#1023)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-20 09:56:52 -03:00
Luccas Mateus
83fd7727ba [flatuitable][m] - add bytes + parsingConfig (#1022) 2023-09-20 08:13:19 -03:00
Anuar Ustayev (aka Anu)
083d3178cd Merge pull request #999 from igoradamenko/igoradamenko-patch-1
Fix wiki-link regexp to match non-Latin characters
2023-09-12 00:18:23 +06:00
João Demenech
3200dc5ade fix(site,docs): missing mddb command instruction on 'Searching datasets' tutorial 2023-09-11 08:21:35 -03:00
Igor Adamenko
3efba6578d Fix wiki-link regexp to match non-Latin characters 2023-08-09 19:02:11 +03:00
12 changed files with 119 additions and 32 deletions

6
package-lock.json generated
View File

@@ -46942,7 +46942,7 @@
},
"packages/ckan": {
"name": "@portaljs/ckan",
"version": "0.0.3",
"version": "0.1.0",
"dependencies": {
"formik": "^2.2.9",
"swr": "^2.1.5",
@@ -47347,7 +47347,7 @@
},
"packages/components": {
"name": "@portaljs/components",
"version": "0.3.1",
"version": "0.3.2",
"dependencies": {
"@githubocto/flat-ui": "^0.14.1",
"@heroicons/react": "^2.0.17",
@@ -47828,7 +47828,7 @@
},
"packages/remark-wiki-link": {
"name": "@portaljs/remark-wiki-link",
"version": "1.0.4",
"version": "1.1.0",
"license": "MIT",
"dependencies": {
"mdast-util-to-markdown": "^1.5.0",

View File

@@ -1,5 +1,11 @@
# @portaljs/components
## 0.4.0
### Minor Changes
- [#1022](https://github.com/datopian/portaljs/pull/1022) [`83fd7727`](https://github.com/datopian/portaljs/commit/83fd7727bafb4902218777597e9848a3e3a71d87) Thanks [@luccasmmg](https://github.com/luccasmmg)! - FlatUiTables now accepts a bytes param and a parsingConfig param for CSV links
## 0.3.2
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@portaljs/components",
"version": "0.3.2",
"version": "0.4.0",
"type": "module",
"description": "https://portaljs.org",
"keywords": [

View File

@@ -5,22 +5,20 @@ import LoadingSpinner from './LoadingSpinner';
const queryClient = new QueryClient();
export async function getCsv(url: string, corsProxy?: string) {
if (corsProxy) {
url = corsProxy + url;
}
export async function getCsv(url: string, bytes) {
const response = await fetch(url, {
headers: {
Range: 'bytes=0-5132288',
Range: `bytes=0-${bytes}`,
},
});
const data = await response.text();
return data;
}
export async function parseCsv(file: string): Promise<any> {
export async function parseCsv(file: string, parsingConfig): Promise<any> {
return new Promise((resolve, reject) => {
Papa.parse(file, {
...parsingConfig,
header: true,
dynamicTyping: true,
skipEmptyLines: true,
@@ -41,25 +39,28 @@ export interface FlatUiTableProps {
url?: string;
data?: { [key: string]: number | string }[];
rawCsv?: string;
corsProxy?: string;
randomId?: number;
bytes: number;
parsingConfig: any;
}
export const FlatUiTable: React.FC<FlatUiTableProps> = ({
url,
data,
rawCsv,
corsProxy,
bytes = 5132288,
parsingConfig = {},
}) => {
const randomId = Math.random();
return (
// Provide the client to your App
<QueryClientProvider client={queryClient}>
<TableInner
corsProxy={corsProxy}
bytes={bytes}
url={url}
data={data}
rawCsv={rawCsv}
randomId={randomId}
parsingConfig={parsingConfig}
/>
</QueryClientProvider>
);
@@ -69,8 +70,9 @@ const TableInner: React.FC<FlatUiTableProps> = ({
url,
data,
rawCsv,
corsProxy,
randomId,
bytes,
parsingConfig,
}) => {
if (data) {
return (
@@ -81,12 +83,16 @@ const TableInner: React.FC<FlatUiTableProps> = ({
}
const { data: csvString, isLoading: isDownloadingCSV } = useQuery(
['dataCsv', url, randomId],
() => getCsv(url as string, corsProxy),
() => getCsv(url as string, bytes),
{ enabled: !!url }
);
const { data: parsedData, isLoading: isParsing } = useQuery(
['dataPreview', csvString, randomId],
() => parseCsv(rawCsv ? (rawCsv as string) : (csvString as string)),
() =>
parseCsv(
rawCsv ? (rawCsv as string) : (csvString as string),
parsingConfig
),
{ enabled: rawCsv ? true : !!csvString }
);
if (isParsing || isDownloadingCSV)

View File

@@ -9,17 +9,24 @@ const meta: Meta = {
tags: ['autodocs'],
argTypes: {
data: {
description: "Data to be displayed in the table, must be setup as an array of key value pairs"
description:
'Data to be displayed in the table, must be setup as an array of key value pairs',
},
csv: {
description: "CSV data as string.",
description: 'CSV data as string.',
},
url: {
description: "Fetch the data from a CSV file remotely. only the first 5MB of data will be displayed"
description:
'Fetch the data from a CSV file remotely. only the first 5MB of data will be displayed',
},
bytes: {
description:
'Fetch the data from a CSV file remotely. only the first <bytes> of data will be displayed',
},
parsingConfig: {
description:
'Configuration for parsing the CSV data. See https://www.papaparse.com/docs#config for more details',
},
corsProxy: {
description: "Optionally you cant set a CORS Proxy to which all your requests you be redirected"
}
},
};
@@ -29,7 +36,7 @@ type Story = StoryObj<FlatUiTableProps>;
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
export const FromColumnsAndData: Story = {
name: "Table data",
name: 'Table data',
args: {
data: [
{ id: 1, lastName: 'Snow', firstName: 'Jon', age: 35 },
@@ -44,20 +51,19 @@ export const FromColumnsAndData: Story = {
};
export const FromRawCSV: Story = {
name: "Table from raw CSV",
name: 'Table from raw CSV',
args: {
rawCsv: `
Year,Temp Anomaly
1850,-0.418
2020,0.923
`
}
`,
},
};
export const FromURL: Story = {
name: "Table from URL",
name: 'Table from URL',
args: {
url: "https://raw.githubusercontent.com/datasets/finance-vix/main/data/vix-daily.csv"
}
url: 'https://ckan-dev.sse.datopian.com/datastore/dump/601c9cf0-595e-46d8-88fc-d1ab2904e2db',
},
};

View File

@@ -79,7 +79,7 @@ function fromMarkdown(opts: FromMarkdownOptions = {}) {
data: { isEmbed, target, alias },
} = wikiLink;
// eslint-disable-next-line no-useless-escape
const wikiLinkWithHeadingPattern = /([\w\s\/\.-]*)(#.*)?/;
const wikiLinkWithHeadingPattern = /([\p{Letter}\d\s\/\.-_]*)(#.*)?/u;
const [, path, heading = ""] = target.match(wikiLinkWithHeadingPattern);
const possibleWikiLinkPermalinks = wikiLinkResolver(path);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 449 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

@@ -0,0 +1,69 @@
---
title: What We Shipped in Jul-Aug 2023
authors: ['ola-rubaj']
date: 2023-09-2
---
Hey everyone! 👋 Summer has been in full swing, and while I've managed to catch some vacation vibes, I've also been deep into code. I'm super excited to share some of the latest updates and features we've rolled out over the past two months. Let's dive in:
## 🌷 Flowershow
https://flowershow.app/
1. **CLI is old news**: the Flowershow CLI has been deprecated in favor of our new [Flowershow Obsidian plugin](https://github.com/datopian/obsidian-flowershow).
2. **Self-publishing made even easier**: I wrote a [self-publish tutorial](https://flowershow.app/docs/publish-howto) to guide you through using our Obsidian plugin for publishing your digital garden.
3. **Cloud-publishing MVP**: The first version of our Flowershow Cloud which aims to make publishing your digital garden notes a breeze! [Check out the overview](https://flowershow.app#cloud-publish) and stay tuned 📻!
4. **Hydration errors from Obsidian transclusions/note embeddings are fixed**: For now, note transclusions will convert to regular links, but stay tuned — support for note embeds may be on the horizon. [Learn more](https://github.com/datopian/flowershow/issues/545)
5. **New Obsidian tags list format support**: I added support for Obsidian's new tag list format, so now your notes can be even more organized. [Learn more](https://github.com/datopian/flowershow/issues/543)
## 🗂️ MarkdownDB
https://github.com/datopian/markdowndb
1. **Auto-Publishing to npm**: Changesets now trigger auto-publishing, so we're always up to date.
2. **Obsidian-style wiki links**: Extracting wiki links with Obsidian-style shortest paths is supported now.
## 📚 The Guide
https://portaljs.org/guide
Ive sketched overviews for two upcoming tutorials:
1. **Collaborating with others on your website**: Learn how to make your website projects a team effort. [See it here](https://portaljs.org/guide#tutorial-3-collaborating-with-others-on-your-website-project)
2. **Customising your website and previewing your changes locally**: Customize and preview your site changes locally, without headaches. [See it here](https://portaljs.org/guide#tutorial-4-customising-your-website-locally-and-previewing-your-changes-locally)
## 🌐 LifeItself.org
https://lifeitself.org/
LifeItself.org is our website built on the Flowershow template, and it's been getting some extra care too.
1. New blog home page layout with:
- **Team Top Selection**
![[life-itself-top-picks.png]]
- **Latest Blog Posts**
![[life-itself-latest-blogs.png]]
- And the long awaited filtering by category 🎉
![[life-itself-categories.png]]
[👉 Check out the changes!](https://lifeitself.org/blog)
2. **Blog posts layout revamp**: Refreshed design with share options, reading time estimates, and more.
![[life-itself-blog-post.png]]
---
That wraps it up for now! As always, I'm eager to hear your thoughts and feedback. Feel free to report issues or ask for features on our GitHub repositories. Until next time and happy publishing!
— Ola Rubaj, Developer at Datopian

View File

@@ -101,7 +101,7 @@ List of available datasets:
<Catalog datasets={datasets} facets={['group']}/>
```
You now have a filter in your page with all possible values automatically added to it.
Rerun `npm run mddb`. You now have a filter in your page with all possible values automatically added to it.
![Data catalog with facets built with PortalJS](https://i.imgur.com/p2miSdg.png)