Skip to content

Commit

Permalink
Apply Prettier changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwicopple authored and actions-user committed May 22, 2021
1 parent 594b8dc commit cd99583
Show file tree
Hide file tree
Showing 204 changed files with 45,344 additions and 47,721 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ Our client library is modular. Each sub-library is a standalone implementation f
- `realtime-{lang}`: Client library to work with [Realtime](https://github.com/supabase/realtime)
- `gotrue-{lang}`: Client library to work with [GoTrue](https://github.com/netlify/gotrue)

| Repo | Official | Community |
| --------------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`supabase-{lang}`** | [`JS`](https://github.com/supabase/supabase-js) | [`C#`](https://github.com/supabase/supabase-csharp) \| [`Dart`](https://github.com/supabase/supabase-dart) \| [`Python`](https://github.com/supabase/supabase-py) \| `Rust` \| [`Ruby`](https://github.com/supabase/supabase-rb)
| `postgrest-{lang}` | [`JS`](https://github.com/supabase/postgrest-js) | [`C#`](https://github.com/supabase/postgrest-csharp) \| [`Dart`](https://github.com/supabase/postgrest-dart) \| [`Python`](https://github.com/supabase/postgrest-py) \| [`Rust`](https://github.com/supabase/postgrest-rs) \| [`Ruby`](https://github.com/supabase/postgrest-rb)
| `realtime-{lang}` | [`JS`](https://github.com/supabase/realtime-js) | [`C#`](https://github.com/supabase/realtime-csharp) \| [`Dart`](https://github.com/supabase/realtime-dart) \| [`Python`](https://github.com/supabase/realtime-py) \| `Rust` \| `Ruby` |
| `gotrue-{lang}` | [`JS`](https://github.com/supabase/gotrue-js) | [`C#`](https://github.com/supabase/gotrue-csharp) \| [`Dart`](https://github.com/supabase/gotrue-dart) \| [`Python`](https://github.com/supabase/gotrue-py) \| `Rust` \| `Ruby` |
| Repo | Official | Community |
| --------------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`supabase-{lang}`** | [`JS`](https://github.com/supabase/supabase-js) | [`C#`](https://github.com/supabase/supabase-csharp) \| [`Dart`](https://github.com/supabase/supabase-dart) \| [`Python`](https://github.com/supabase/supabase-py) \| `Rust` \| [`Ruby`](https://github.com/supabase/supabase-rb) |
| `postgrest-{lang}` | [`JS`](https://github.com/supabase/postgrest-js) | [`C#`](https://github.com/supabase/postgrest-csharp) \| [`Dart`](https://github.com/supabase/postgrest-dart) \| [`Python`](https://github.com/supabase/postgrest-py) \| [`Rust`](https://github.com/supabase/postgrest-rs) \| [`Ruby`](https://github.com/supabase/postgrest-rb) |
| `realtime-{lang}` | [`JS`](https://github.com/supabase/realtime-js) | [`C#`](https://github.com/supabase/realtime-csharp) \| [`Dart`](https://github.com/supabase/realtime-dart) \| [`Python`](https://github.com/supabase/realtime-py) \| `Rust` \| `Ruby` |
| `gotrue-{lang}` | [`JS`](https://github.com/supabase/gotrue-js) | [`C#`](https://github.com/supabase/gotrue-csharp) \| [`Dart`](https://github.com/supabase/gotrue-dart) \| [`Python`](https://github.com/supabase/gotrue-py) \| `Rust` \| `Ruby` |

<!--- Remove this list if you're traslating to another language, it's hard to keep updated across multiple files-->
<!--- Keep only the link to the list of translation files-->
Expand Down
6 changes: 2 additions & 4 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@

## Supported Versions


| Version | Supported |
| ------- | ------------------ |
| All | :white_check_mark: |
| All | :white_check_mark: |

## Reporting a Vulnerability

Contact: security@supabase.io
Canonical: https://supabase.io/.well-known/security.txt


At Supabase, we consider the security of our systems a top priority. But no matter how much effort we put into system security, there can still be vulnerabilities present.

If you discover a vulnerability, we would like to know about it so we can take steps to address it as quickly as possible. We would like to ask you to help us better protect our clients and our systems.

Please do the following:

- E-mail your findings to security@supabase.io.
- E-mail your findings to security@supabase.io.
- Do not take advantage of the vulnerability or problem you have discovered, for example by downloading more data than necessary to demonstrate the vulnerability or deleting or modifying other people's data,
- Do not reveal the problem to others until it has been resolved,
- Do not use attacks on physical security, social engineering, distributed denial of service, spam or applications of third parties, and
Expand Down
4 changes: 1 addition & 3 deletions examples/expo-todo-list/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
},
Expand Down
6 changes: 3 additions & 3 deletions examples/expo-todo-list/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = function(api) {
api.cache(true);
module.exports = function (api) {
api.cache(true)
return {
presets: ['babel-preset-expo'],
plugins: ['inline-dotenv'],
}
};
}
3 changes: 1 addition & 2 deletions examples/javascript-auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ How to sign up and login using supabase and supabase-js using HTML and JavaScrip
<img width="558" alt="image" src="https://user-images.githubusercontent.com/458736/88377414-b6fb4180-cdd1-11ea-8061-103ec4577b7b.png">

### running

`npm run dev` (requires npx to be installed)

if you want to make changes without restarting the server run this in a different terminal window:
`npm run watch`


72 changes: 29 additions & 43 deletions examples/nextjs-live-tracker-map/components/MapInput.js
Original file line number Diff line number Diff line change
@@ -1,77 +1,63 @@
import { useEffect, useState, useRef, useMemo, useCallback } from "react";
import { MapContainer, TileLayer, Marker, Popup, Circle } from "react-leaflet";
import { RoundToFixDecimals } from "lib/utils";
import { supabase } from "lib/api";
import TextLog from "components/TextLog";
import { useEffect, useState, useRef, useMemo, useCallback } from 'react'
import { MapContainer, TileLayer, Marker, Popup, Circle } from 'react-leaflet'
import { RoundToFixDecimals } from 'lib/utils'
import { supabase } from 'lib/api'
import TextLog from 'components/TextLog'

function DraggableMarker({ initialPos, addCircle }) {
const [position, setPosition] = useState(initialPos);
const markerRef = useRef(null);
const [position, setPosition] = useState(initialPos)
const markerRef = useRef(null)
const eventHandlers = useMemo(
() => ({
dragend() {
const marker = markerRef.current;
const pos = marker.getLatLng();
if (addCircle) addCircle(pos);
if (marker) setPosition(pos);
const marker = markerRef.current
const pos = marker.getLatLng()
if (addCircle) addCircle(pos)
if (marker) setPosition(pos)
},
}),
[addCircle]
);
)

return (
<Marker
draggable={true}
eventHandlers={eventHandlers}
position={position}
ref={markerRef}
>
<Marker draggable={true} eventHandlers={eventHandlers} position={position} ref={markerRef}>
<Popup minWidth={90}>
{`lat: ${position.lat}`}
<br />
{`long: ${position.lng}`}
</Popup>
</Marker>
);
)
}

function MapInput({ clientRef, center, zoom }) {
const [log, setLog] = useState(undefined);
const [circles, setCircles] = useState([]);
const [log, setLog] = useState(undefined)
const [circles, setCircles] = useState([])

useEffect(() => {
let newLog = `Ref: ${clientRef}\nReady to send location...`;
let newLog = `Ref: ${clientRef}\nReady to send location...`
newLog += circles.map((item) => {
return `\nsent lat=${RoundToFixDecimals(
item.lat
)} long=${RoundToFixDecimals(item.lng)}`;
});
setLog(newLog);
}, [circles, clientRef]);
return `\nsent lat=${RoundToFixDecimals(item.lat)} long=${RoundToFixDecimals(item.lng)}`
})
setLog(newLog)
}, [circles, clientRef])

const onAddCircle = useCallback(
async (pos) => {
setCircles([...circles, pos]);
setCircles([...circles, pos])

// insert new location
await supabase
.from("locations")
.insert([
{ latitude: pos.lat, longitude: pos.lng, user_id: clientRef },
]);
.from('locations')
.insert([{ latitude: pos.lat, longitude: pos.lng, user_id: clientRef }])
},
[setCircles, circles, supabase, clientRef]
);
)

function renderCircles() {
return circles.map((item, index) => (
<Circle
key={`${index}`}
center={item}
pathOptions={{ fillColor: "blue" }}
radius={20}
/>
));
<Circle key={`${index}`} center={item} pathOptions={{ fillColor: 'blue' }} radius={20} />
))
}

return (
Expand All @@ -96,6 +82,6 @@ function MapInput({ clientRef, center, zoom }) {
}
`}</style>
</div>
);
)
}
export default MapInput;
export default MapInput
88 changes: 41 additions & 47 deletions examples/nextjs-live-tracker-map/components/MapView.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,43 @@
import { useEffect, useReducer } from "react";
import { MapContainer, TileLayer, Polyline } from "react-leaflet";
import { RoundToFixDecimals } from "lib/utils";
import { supabase } from "lib/api";
import TextLog from "components/TextLog";
import { useEffect, useReducer } from 'react'
import { MapContainer, TileLayer, Polyline } from 'react-leaflet'
import { RoundToFixDecimals } from 'lib/utils'
import { supabase } from 'lib/api'
import TextLog from 'components/TextLog'

export default function MapView({ center, zoom }) {
const [state, dispatch] = useReducer(mapReducer, initialState);
const [state, dispatch] = useReducer(mapReducer, initialState)

useEffect(() => {
// Listen to INSERT event on locations table
const subscription = supabase
.from("locations")
.on("INSERT", (payload) => {
console.log("New Position received!", payload);
dispatch({ payload: payload.new });
.from('locations')
.on('INSERT', (payload) => {
console.log('New Position received!', payload)
dispatch({ payload: payload.new })
})
.subscribe();
.subscribe()

return () => {
if (subscription) supabase.removeSubscription(subscription);
};
}, []);
if (subscription) supabase.removeSubscription(subscription)
}
}, [])

function drawPolylines() {
let result = Object.keys(state.userPositions).map((key, idx) => {
const item = state.userPositions[key];
if (!item) return;
const item = state.userPositions[key]
if (!item) return

const { color, data } = item;
const { color, data } = item
const polyline = data.map((item) => {
if (!item) return;
const { lat, lng } = item;
return [lat, lng];
});
if (!item) return
const { lat, lng } = item
return [lat, lng]
})

return (
<Polyline
key={`line-${idx}`}
pathOptions={{ color: color }}
positions={polyline}
/>
);
});
return <Polyline key={`line-${idx}`} pathOptions={{ color: color }} positions={polyline} />
})

return result;
return result
}

return (
Expand All @@ -57,35 +51,35 @@ export default function MapView({ center, zoom }) {
</MapContainer>
<TextLog log={state.log} />
</div>
);
)
}

function randomColor() {
var array = ["black", "magenta", "blue", "indigo", "green", "blueviolet"];
return array[Math.floor(Math.random() * array.length)];
var array = ['black', 'magenta', 'blue', 'indigo', 'green', 'blueviolet']
return array[Math.floor(Math.random() * array.length)]
}

const initialState = {
log: "Start listerning...",
log: 'Start listerning...',
userPositions: {},
};
}

const mapReducer = (state, action) => {
const { id, user_id, latitude: lat, longitude: lng } = action.payload;
const position = { id, user_id, lat, lng };
const { id, user_id, latitude: lat, longitude: lng } = action.payload
const position = { id, user_id, lat, lng }

let positions = state.userPositions[user_id];
if (positions) positions.data = [...positions.data, position];
else positions = { color: randomColor(), data: [position] };
const userPositions = { ...state.userPositions, [user_id]: positions };
let positions = state.userPositions[user_id]
if (positions) positions.data = [...positions.data, position]
else positions = { color: randomColor(), data: [position] }
const userPositions = { ...state.userPositions, [user_id]: positions }

let log = state.log;
log += `\nuser_id=${user_id}`;
log += ` lat=${RoundToFixDecimals(lat)}`;
log += ` long=${RoundToFixDecimals(lng)}`;
let log = state.log
log += `\nuser_id=${user_id}`
log += ` lat=${RoundToFixDecimals(lat)}`
log += ` long=${RoundToFixDecimals(lng)}`

return {
log,
userPositions,
};
};
}
}
7 changes: 3 additions & 4 deletions examples/nextjs-live-tracker-map/components/PageLayout.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Head from "next/head";
import Head from 'next/head'

export default function PageLayout({ title, children }) {
return (
Expand All @@ -10,10 +10,9 @@ export default function PageLayout({ title, children }) {

<footer className="footer">
<a href="https://supabase.io" target="_blank" rel="noopener noreferrer">
Powered by{" "}
<img src="/supabase.svg" alt="Supabase Logo" className="logo" />
Powered by <img src="/supabase.svg" alt="Supabase Logo" className="logo" />
</a>
</footer>
</div>
);
)
}
Loading

0 comments on commit cd99583

Please sign in to comment.