Skip to content

Commit

Permalink
Merge branch 'commaai:master' into inifite-scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
yaodingyd authored Jun 7, 2024
2 parents 75bcb30 + b64f2cd commit 63d0f84
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
28 changes: 25 additions & 3 deletions .github/workflows/preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
workflow_run:
workflows: ["build"]
types:
- requested
- completed

permissions:
Expand All @@ -12,10 +13,11 @@ permissions:

jobs:
preview:
#if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }}
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
Expand All @@ -24,12 +26,30 @@ jobs:
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Find PR number
id: pr
uses: actions/github-script@v7
with:
script: |
const response = await github.rest.search.issuesAndPullRequests({
q: 'repo:${{ github.repository }} is:pr sha:${{ github.event.workflow_run.head_sha }}',
per_page: 1,
})
const items = response.data.items
if (items.length < 1) {
console.error('No PRs found')
return
}
const pullRequestNumber = items[0].number
console.info("Pull request number is", pullRequestNumber)
return pullRequestNumber
# deploy
- name: Deploy to Cloudflare Pages
id: cloudflare-publish
uses: cloudflare/[email protected]
with:
branch: ${{ github.event.number }}
branch: ${{ steps.pr.outputs.result }}
projectName: connect
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }}
Expand All @@ -45,5 +65,7 @@ jobs:
* mark your PR as a draft until it's ready to review
* post the preview on [Discord](https://discord.comma.ai); feedback from users will speedup the PR review
deployed preview: https://${{ github.event.number }}.connect-d5y.pages.dev
deployed preview: https://${{ steps.pr.outputs.result }}.connect-d5y.pages.dev
comment_tag: run_id
pr_number: ${{ steps.pr.outputs.result }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 9 additions & 2 deletions src/components/explorer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import IosPwaPopup from './IosPwaPopup';
import AppDrawer from './AppDrawer';
import PullDownReload from './utils/PullDownReload';

import { analyticsEvent, selectDevice, updateDevice } from '../actions';
import { analyticsEvent, selectDevice, updateDevice, selectTimeFilter } from '../actions';
import init from '../actions/startup';
import Colors from '../colors';
import { play, pause } from '../timeline/playback';
Expand Down Expand Up @@ -136,7 +136,7 @@ class ExplorerApp extends Component {
}

componentDidUpdate(prevProps, prevState) {
const { pathname, zoom } = this.props;
const { pathname, zoom, dongleId } = this.props;

if (prevProps.pathname !== pathname) {
this.setState({ drawerIsOpen: false });
Expand All @@ -148,6 +148,13 @@ class ExplorerApp extends Component {
if (prevProps.zoom && !zoom) {
this.props.dispatch(pause());
}

// FIXME: ensures demo routes stay visible. can be removed once we're infinite scrolling
if (prevProps.dongleId !== dongleId) {
const d = new Date();
d.setHours(d.getHours() + 1, 0, 0, 0);
this.props.dispatch(selectTimeFilter(d.getTime() - (1000 * 60 * 60 * 24 * 365), d.getTime()));
}
}

async closePair() {
Expand Down

0 comments on commit 63d0f84

Please sign in to comment.