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

adding more queries, updating the README file and other small changes #3

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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: 25 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Contributing to React Native Lens UI Kit 🌿

To run and develop with the project locally, do the following:

1. Clone the repo:

```sh
git clone [email protected]:lens-protocol/react-native-lens-ui-kit.git
```

2. Install the dependencies

```sh
npm install

# or use yarn, pnpm, etc..
```

3. Open `watcher.js` and configure the directory of your React Native project (`destDir`).

4. Run the develop scripts:

```sh
npm run dev
```
7 changes: 7 additions & 0 deletions License
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ISC License (ISC)

Copyright 2023 Lens Protocol

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
108 changes: 46 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ A React Native UI kit for [Lens Protocol](https://lens.xyz/). Get started buildi

Example app codebase located [here](https://github.com/dabit3/dabit3-react-native-lens-example)

## Table of Contents

- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#prerequisites)
- [Components](#components)
- [Feed](#feed)
- [Profiles](#profiles)
- [Profile Header](#profile-header)
- [Publication](#ublication)
- [ProfileListItem](#profilelistitem)
- [LensProvider](#lensprovider)
- [Roadmap](#roadmap)
- [Beta Roadmap](#beta-roadmap)
- [V1 Roadmap](#v1-roadmap)

## Getting started 🚀

### Prerequisites
Expand All @@ -25,9 +41,9 @@ npm install @lens-protocol/react-native-lens-ui-kit
A feed of posts from Lens.

```tsx
import { Feed } from '@lens-protocol/react-native-lens-ui-kit'
import { Feed } from "@lens-protocol/react-native-lens-ui-kit";

<Feed />
<Feed />;
```

### Default props
Expand Down Expand Up @@ -78,23 +94,23 @@ styles = StyleSheet.create({

### Query options for `Feed`

__explorePublications (default)__
**explorePublications (default)**
[explorePublications](./src/graphql/explorePublications.graphql)

__getPublications__
**getPublications**
[getPublications](./src/graphql/getPublications.graphql)

__getComments__
**getComments**
[getPublications](./src/graphql/getPublications.graphql)

## Profiles

A list of profiles

```tsx
import { Profiles } from '@lens-protocol/react-native-lens-ui-kit'
import { Profiles } from "@lens-protocol/react-native-lens-ui-kit";

<Profiles />
<Profiles />;
```

### Default Props
Expand All @@ -117,23 +133,20 @@ onProfilePress = profile => console.log({ profile })

### Query options for `Profiles`

__exploreProfiles (default)__
**exploreProfiles (default)**
[exploreProfiles](./src/graphql/exploreProfiles.graphql)

__getFollowing__
**getFollowing**
[getFollowing](./src/graphql/getFollowing.graphql)


## Profile

Renders an individual profile

```tsx
import { Profile } from '@lens-protocol/react-native-lens-ui-kit'
import { Profile } from "@lens-protocol/react-native-lens-ui-kit";

<Profile
profile={profile}
/>
<Profile profile={profile} />;
```

### Default props
Expand Down Expand Up @@ -163,21 +176,22 @@ onLikePress = publication => console.log({ publication })
```

### Styles
publicationStyles = [PublicationStyles](https://github.com/lens-protocol/react-native-lens-ui-kit/blob/main/src/types.ts#L137)
headerStyles = [ProfileHeaderStyles](https://github.com/lens-protocol/react-native-lens-ui-kit/blob/main/src/types.ts#L157)

publicationStyles = [PublicationStyles](https://github.com/lens-protocol/react-native-lens-ui-kit/blob/main/src/types.ts#L137)
headerStyles = [ProfileHeaderStyles](https://github.com/lens-protocol/react-native-lens-ui-kit/blob/main/src/types.ts#L157)
feedStyles = [FeedStyles](https://github.com/lens-protocol/react-native-lens-ui-kit/blob/main/src/types.ts#L188)

## Profile Header

Renders a profile header component.

```tsx
import { ProfileHeader } from '@lens-protocol/react-native-lens-ui-kit'
import { ProfileHeader } from "@lens-protocol/react-native-lens-ui-kit";

<ProfileHeader
profile={profile}
// or profileId={profileId}
/>
/>;
```

### Default props
Expand All @@ -189,19 +203,18 @@ onFollowingPress = profile => console.log({ profile })
onFollowersPress = profile => console.log({ profile })
```

### Styles
### Styles

[ProfileHeaderStyles](https://github.com/lens-protocol/react-native-lens-ui-kit/blob/main/src/types.ts#L157)

## Publication

Renders an individual publication.

```tsx
import { Publication } from '@lens-protocol/react-native-lens-ui-kit'
import { Publication } from "@lens-protocol/react-native-lens-ui-kit";

<Publication
publication={publication}
/>
<Publication publication={publication} />;
```

### Default props
Expand All @@ -222,19 +235,18 @@ onLikePress = publication => console.log({ publication })
onProfileImagePress = publication => console.log({ publication })
```

### Styles
### Styles

[PublicationStyles](https://github.com/lens-protocol/react-native-lens-ui-kit/blob/main/src/types.ts#L137)

## ProfileListItem

Renders a list item for a profile overview.

```tsx
import { ProfileListItem } from '@lens-protocol/react-native-lens-ui-kit'
import { ProfileListItem } from "@lens-protocol/react-native-lens-ui-kit";

<ProfileListItem
profile={profile}
/>
<ProfileListItem profile={profile} />;
```

### Default props
Expand All @@ -246,7 +258,8 @@ onProfilePress
onFollowPress
```

### Styles
### Styles

[ProfileListItemStyles](https://github.com/lens-protocol/react-native-lens-ui-kit/blob/main/src/types.ts#L173)

## LensProvider
Expand All @@ -266,15 +279,12 @@ theme? = 'light' (default) | 'dark
import {
LensProvider,
Theme,
Environment
} from '@lens-protocol/react-native-lens-ui-kit'
Environment,
} from "@lens-protocol/react-native-lens-ui-kit";

<LensProvider
environment={Environment.mainnet}
theme={Theme.dark}
>
<LensProvider environment={Environment.mainnet} theme={Theme.dark}>
<App />
</LensProvider>
</LensProvider>;
```

# Roadmap
Expand All @@ -297,29 +307,3 @@ Currently this project is in Alpha.
- Improved theme-ing
- Better TypeScript support
- Support audio

### Contribute

To run and develop with the project locally, do the following:

1. Clone the repo:

```sh
git clone [email protected]:lens-protocol/react-native-lens-ui-kit.git
```

2. Install the dependencies

```sh
npm install

# or use yarn, pnpm, etc..
```

3. Open `watcher.js` and configure the directory of your React Native project (`destDir`).

4. Run the develop scripts:

```sh
npm run dev
```
22 changes: 11 additions & 11 deletions src/api.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { createClient as createUrqlClient } from 'urql'
import { Environment } from './types'
import { createClient as createUrqlClient } from "urql";
import { Environment } from "./types/types";

const environments = {
testnet: 'https://api-mumbai.lens.dev',
sandbox: 'https://api-sandbox-mumbai.lens.dev',
mainnet: 'https://api.lens.dev'
}
testnet: "https://api-mumbai.lens.dev",
sandbox: "https://api-sandbox-mumbai.lens.dev",
mainnet: "https://api.lens.dev",
};

/* creates the API client */
export function createClient(env:Environment = Environment.mainnet) {
const APIURL = environments[env] || environments.mainnet
export function createClient(env: Environment = Environment.mainnet) {
const APIURL = environments[env] || environments.mainnet;
return createUrqlClient({
url: APIURL
})
}
url: APIURL,
});
}
8 changes: 3 additions & 5 deletions src/codegen.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@


schema: 'https://api.lens.dev'
documents: './src/graphql/*.graphql'
schema: "https://api.lens.dev"
documents: "./src/graphql/**/*.graphql"
generates:
./src/graphql/generated.ts:
plugins:
Expand All @@ -11,4 +9,4 @@ generates:
- fragment-matcher
config:
fetcher: fetch
dedupeFragments: true
dedupeFragments: true
Loading