This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Cordova React TypeScript (from react ts sample @build2016) #100
Open
ridomin
wants to merge
7
commits into
microsoft:master
Choose a base branch
from
ridomin:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
49212a1
cordova react sample from build2016
ridomin 3bee5b5
vs project
ridomin 9763fa8
remove dup vs proj
ridomin e0d202a
move scripts, add README, and tune tsconfig
rido-min 7c940ad
inline sources
rido-min 4b2984e
disabling inline source maps
rido-min a7ec619
add readme option, block TS in VS
rido-min File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
typings | ||
node_modules | ||
|
||
|
||
plugins/ | ||
platforms/ | ||
.vs/ | ||
.vscode/ | ||
bin/ | ||
bld/ | ||
app/*.js | ||
app/*.map | ||
|
||
*.user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as React from "react"; | ||
import { Submission } from "./reddit" | ||
|
||
export interface SubmissionProps extends Submission { | ||
elementPosition: number; | ||
} | ||
|
||
let imageStyle = { | ||
maxWidth: "600px", | ||
maxHeight: "600px", | ||
}; | ||
|
||
export const SubmissionComp = (submission: SubmissionProps) => | ||
<div style={{ fontFamily: "sans-serif" }}> | ||
{ submission.elementPosition ? <br /> : "" } | ||
<span style={{ fontSize: "1.2rem" }}> | ||
<span>{ submission.elementPosition + 1 }.</span> | ||
<a href={ submission.url }>{submission.title}</a> | ||
</span> | ||
<span> ({ submission.domain }) </span> | ||
<div> | ||
Submitted at { new Date(submission.created_utc).toLocaleTimeString() }. | ||
</div> | ||
<img src={submission.url} style={imageStyle}/> | ||
</div>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as $ from "jquery"; | ||
import * as React from "react"; | ||
import * as ReactDOM from "react-dom"; | ||
|
||
import { ApiResponse } from "./reddit"; | ||
import { SubmissionComp } from "./RedditSubmission" | ||
|
||
function displaySubreddit(subreddit: string) { | ||
let settings = { | ||
url: `https://www.reddit.com/r/${subreddit}.json` | ||
}; | ||
$.ajax(settings).done(response => { | ||
let submissions = (response as ApiResponse).data.children; | ||
// TODO: filter on images | ||
submissions = submissions.filter(({ data }) => /(png|jpg)$/.test(data.url)); | ||
let components = submissions.map((value, index) => | ||
<SubmissionComp key={ index } elementPosition={ index } { ...value.data } /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No spaces in JSX attribute expressions |
||
); | ||
ReactDOM.render(<div>{ components }</div>, document.getElementById("content")); | ||
}); | ||
} | ||
|
||
displaySubreddit("aww"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export interface ApiResponse { | ||
data: { | ||
children: { | ||
data: Submission | ||
}[]; | ||
}; | ||
} | ||
|
||
export interface Submission { | ||
author: string; | ||
domain: string; | ||
title: string; | ||
subreddit: string; | ||
url: string; | ||
created_utc: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<widget id="vs.mdd.taco.react" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> | ||
<name>React Cordova Demo</name> | ||
<description>A blank project that uses Apache Cordova to help you build an app that targets multiple mobile platforms: Android, iOS, Windows, and Windows Phone.</description> | ||
<author email="[email protected]" href="http://cordova.io">Apache Cordova Team</author> | ||
<content src="index.html" /> | ||
<access origin="*" /> | ||
<preference name="SplashScreen" value="screen" /> | ||
<preference name="windows-target-version" value="8.1" /> | ||
<preference name="windows-phone-target-version" value="8.1" /> | ||
<plugin name="cordova-plugin-whitelist" spec="1" /> | ||
<allow-intent href="http://*/*" /> | ||
<allow-intent href="https://*/*" /> | ||
<allow-intent href="tel:*" /> | ||
<allow-intent href="sms:*" /> | ||
<allow-intent href="mailto:*" /> | ||
<allow-intent href="geo:*" /> | ||
<allow-navigation href="http://m.imgur.com" /> | ||
<platform name="android"> | ||
<allow-intent href="market:*" /> | ||
</platform> | ||
<platform name="ios"> | ||
<allow-intent href="itms:*" /> | ||
<allow-intent href="itms-apps:*" /> | ||
</platform> | ||
<platform name="android"> | ||
<icon density="ldpi" src="res/icons/android/icon-36-ldpi.png" /> | ||
<icon density="mdpi" src="res/icons/android/icon-48-mdpi.png" /> | ||
<icon density="hdpi" src="res/icons/android/icon-72-hdpi.png" /> | ||
<icon density="xhdpi" src="res/icons/android/icon-96-xhdpi.png" /> | ||
</platform> | ||
<platform name="ios"> | ||
<icon height="180" src="res/icons/ios/icon-60-3x.png" width="180" /> | ||
<icon height="60" src="res/icons/ios/icon-60.png" width="60" /> | ||
<icon height="120" src="res/icons/ios/icon-60-2x.png" width="120" /> | ||
<icon height="76" src="res/icons/ios/icon-76.png" width="76" /> | ||
<icon height="152" src="res/icons/ios/icon-76-2x.png" width="152" /> | ||
<icon height="40" src="res/icons/ios/icon-40.png" width="40" /> | ||
<icon height="80" src="res/icons/ios/icon-40-2x.png" width="80" /> | ||
<icon height="57" src="res/icons/ios/icon-57.png" width="57" /> | ||
<icon height="114" src="res/icons/ios/icon-57-2x.png" width="114" /> | ||
<icon height="72" src="res/icons/ios/icon-72.png" width="72" /> | ||
<icon height="144" src="res/icons/ios/icon-72-2x.png" width="144" /> | ||
<icon height="29" src="res/icons/ios/icon-small.png" width="29" /> | ||
<icon height="58" src="res/icons/ios/icon-small-2x.png" width="58" /> | ||
<icon height="50" src="res/icons/ios/icon-50.png" width="50" /> | ||
<icon height="100" src="res/icons/ios/icon-50-2x.png" width="100" /> | ||
</platform> | ||
<platform name="windows"> | ||
<icon height="150" src="res/icons/windows/Square150x150Logo.scale-100.png" width="150" /> | ||
<icon height="360" src="res/icons/windows/Square150x150Logo.scale-240.png" width="360" /> | ||
<icon height="30" src="res/icons/windows/Square30x30Logo.scale-100.png" width="30" /> | ||
<icon height="310" src="res/icons/windows/Square310x310Logo.scale-100.png" width="310" /> | ||
<icon height="106" src="res/icons/windows/Square44x44Logo.scale-240.png" width="106" /> | ||
<icon height="70" src="res/icons/windows/Square70x70Logo.scale-100.png" width="70" /> | ||
<icon height="170" src="res/icons/windows/Square71x71Logo.scale-240.png" width="170" /> | ||
<icon height="50" src="res/icons/windows/StoreLogo.scale-100.png" width="50" /> | ||
<icon height="120" src="res/icons/windows/StoreLogo.scale-240.png" width="120" /> | ||
<icon height="150" src="res/icons/windows/Wide310x150Logo.scale-100.png" width="310" /> | ||
<icon height="360" src="res/icons/windows/Wide310x150Logo.scale-240.png" width="744" /> | ||
</platform> | ||
<platform name="wp8"> | ||
<icon height="99" src="res/icons/wp8/ApplicationIcon.png" width="99" /> | ||
<icon height="159" src="res/icons/wp8/Background.png" width="159" /> | ||
</platform> | ||
<platform name="android"> | ||
<splash density="land-hdpi" src="res/screens/android/screen-hdpi-landscape.png" /> | ||
<splash density="land-ldpi" src="res/screens/android/screen-ldpi-landscape.png" /> | ||
<splash density="land-mdpi" src="res/screens/android/screen-mdpi-landscape.png" /> | ||
<splash density="land-xhdpi" src="res/screens/android/screen-xhdpi-landscape.png" /> | ||
<splash density="port-hdpi" src="res/screens/android/screen-hdpi-portrait.png" /> | ||
<splash density="port-ldpi" src="res/screens/android/screen-ldpi-portrait.png" /> | ||
<splash density="port-mdpi" src="res/screens/android/screen-mdpi-portrait.png" /> | ||
<splash density="port-xhdpi" src="res/screens/android/screen-xhdpi-portrait.png" /> | ||
</platform> | ||
<platform name="ios"> | ||
<splash height="480" src="res/screens/ios/screen-iphone-portrait.png" width="320" /> | ||
<splash height="960" src="res/screens/ios/screen-iphone-portrait-2x.png" width="640" /> | ||
<splash height="1024" src="res/screens/ios/screen-ipad-portrait.png" width="768" /> | ||
<splash height="2048" src="res/screens/ios/screen-ipad-portrait-2x.png" width="1536" /> | ||
<splash height="768" src="res/screens/ios/screen-ipad-landscape.png" width="1024" /> | ||
<splash height="1536" src="res/screens/ios/screen-ipad-landscape-2x.png" width="2048" /> | ||
<splash height="1136" src="res/screens/ios/screen-iphone-568h-2x.png" width="640" /> | ||
<splash height="1334" src="res/screens/ios/screen-iphone-portrait-667h.png" width="750" /> | ||
<splash height="2208" src="res/screens/ios/screen-iphone-portrait-736h.png" width="1242" /> | ||
<splash height="1242" src="res/screens/ios/screen-iphone-landscape-736h.png" width="2208" /> | ||
</platform> | ||
<platform name="windows"> | ||
<splash height="300" src="res/screens/windows/SplashScreen.scale-100.png" width="620" /> | ||
<splash height="1920" src="res/screens/windows/SplashScreen.scale-240.png" width="1152" /> | ||
<splash height="1920" src="res/screens/windows/SplashScreenPhone.scale-240.png" width="1152" /> | ||
</platform> | ||
<platform name="wp8"> | ||
<splash height="1280" src="res/screens/wp8/SplashScreenImage.png" width="768" /> | ||
</platform> | ||
</widget> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" /> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Debug|Android"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Android</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|iOS"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>iOS</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|Windows-AnyCPU"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Windows-AnyCPU</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|Windows-x64"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Windows-x64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|Windows-x86"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Windows-x86</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|Windows-ARM"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Windows-ARM</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|Windows Phone 8"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Windows Phone 8</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|Windows Phone (Universal)"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Windows Phone (Universal)</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Android"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Android</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|iOS"> | ||
<Configuration>Release</Configuration> | ||
<Platform>iOS</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Windows-AnyCPU"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Windows-AnyCPU</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Windows-x64"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Windows-x64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Windows-x86"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Windows-x86</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Windows-ARM"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Windows-ARM</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Windows Phone 8"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Windows Phone 8</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Windows Phone (Universal)"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Windows Phone (Universal)</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Service Include="{4a0dddb5-7a95-4fbf-97cc-616d07737a77}" /> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>1c20ec9d-2298-4a4a-90cb-32327ba6dc32</ProjectGuid> | ||
</PropertyGroup> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0'"> | ||
<VisualStudioVersion>14.0</VisualStudioVersion> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<TypeScriptCompileOnSaveEnabled>false</TypeScriptCompileOnSaveEnabled> | ||
</PropertyGroup> | ||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\ApacheCordovaTools\vs-mda-targets\Microsoft.TypeScript.MDA.targets" /> | ||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\ApacheCordovaTools\vs-mda-targets\Microsoft.MDA.FileMirroring.targets" /> | ||
<PropertyGroup> | ||
<ProjectUISubcaption>Tools for Apache Cordova</ProjectUISubcaption> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<TargetPlatformIdentifier>MDD</TargetPlatformIdentifier> | ||
</PropertyGroup> | ||
<Target Name="EnsureBuildPrerequisites"> | ||
<!-- These errors will trigger if building from inside Visual Studio and requirements could not be determined --> | ||
<Error Condition="$(MDAPropertiesEvaluated) == 'true' And $(NodeJsDir) == ''" Text="Path to NodeJs could not be determined. Please check that NodeJs has been installed." /> | ||
<Error Condition="$(MDAPropertiesEvaluated) == 'true' And $(MDAVsixDir) == ''" Text="Path to the Visual Studio Extension for Tools for Apache Cordova could not be determined. Please check that the extension has been installed." /> | ||
<!-- These errors will trigger if building from outside Visual Studio (e.g. command line) and environment variables have not been set --> | ||
<Error Condition="$(MDAPropertiesEvaluated) == '' And $(NodeJsDir) == ''" Text="Path to NodeJs has not been specified. Please check that NodeJs has been installed and set the NodeJsDir environment variable before building." /> | ||
<Error Condition="$(MDAPropertiesEvaluated) == '' And $(MDAVsixDir) == ''" Text="Path to Visual Studio Extension for Tools for Apache Cordova has not been specified. Please install it and set the MDAVsixDir environment variable before building." /> | ||
<!-- Sanity check that things exist in the specified places. These are more likely to fail if building outside Visual Studio and the required environment variables have not been set, or set incorrectly. --> | ||
<Error Condition="!Exists('$(NodeJsDir)') Or !Exists('$(NodeJsDir)\node.exe')" Text="The specified NodeJs directory $(NodeJsDir) either does not exist, or does not contain node.exe. Please check that NodeJs has been installed, and set the NodeJsDir variable to the correct directory." /> | ||
<Error Condition="!Exists('$(MDAVsixDir)') Or !Exists('$(MDAVsixDir)\packages\vs-tac')" Text="The specified directory to the Visual Studio extension $(MDAVsixDir)\node.exe either does not exist, or does not contain a packages\vs-tac sub-directory. Please check that the extension directory exists and set the MDAVsixDir variable to the correct directory." /> | ||
<!-- Installs (if necessary) the supporting Nodejs module --> | ||
<Exec Command=""$(MDAVsixDir)"\packages\vs-tac\install "$(NodeJsDir)" "$(MDAVsixDir)"\packages\vs-tac" /> | ||
</Target> | ||
<ProjectExtensions> | ||
<VisualStudio> | ||
<UserProperties /> | ||
</VisualStudio> | ||
</ProjectExtensions> | ||
<Import Project="_apacheCordovaProjectSourceItems.Targets" Condition="Exists('_apacheCordovaProjectSourceItems.Targets')" /> | ||
<Target Name="BeforeBuild"> | ||
<Exec Command="npm run bundle" /> | ||
</Target> | ||
|
||
</Project> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're already filtering on the images.